-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBooleanViewComponent.cs
More file actions
43 lines (38 loc) · 2.14 KB
/
BooleanViewComponent.cs
File metadata and controls
43 lines (38 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.AspNetCore.Mvc.Components;
namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {
/*============================================================================================================================
| CLASS: BOOLEAN (VIEW COMPONENT)
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Delivers a view model for a boolean attribute type.
/// </summary>
public class BooleanViewComponent: ViewComponent {
/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new instance of a <see cref="BooleanViewComponent"/> with necessary dependencies.
/// </summary>
/// <returns>A topic <see cref="NavigationTopicViewComponentBase{T}"/>.</returns>
public BooleanViewComponent() : base() { }
/*==========================================================================================================================
| METHOD: INVOKE
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Assembles the view model for the <see cref="BooleanViewComponent"/>.
/// </summary>
public IViewComponentResult Invoke(
EditingTopicViewModel currentTopic,
BooleanAttributeDescriptorViewModel attribute,
string htmlFieldPrefix
) {
ViewData.TemplateInfo.HtmlFieldPrefix = htmlFieldPrefix;
return View(new BooleanAttributeViewModel(currentTopic, attribute));
}
} // Class
} // Namespace