-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathJsEvaluationViewModel.cs
More file actions
73 lines (66 loc) · 1.74 KB
/
JsEvaluationViewModel.cs
File metadata and controls
73 lines (66 loc) · 1.74 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
#if NET451_OR_GREATER || NETSTANDARD || NETCOREAPP
using Microsoft.AspNetCore.Mvc.Rendering;
#elif NET40
using System.Web.Mvc;
#else
#error No implementation for this target
#endif
using JavaScriptEngineSwitcher.Sample.Resources;
namespace JavaScriptEngineSwitcher.Sample.Logic.Models
{
/// <summary>
/// JS evaluation view model
/// </summary>
public sealed class JsEvaluationViewModel
{
/// <summary>
/// Gets or sets a name of JS engine
/// </summary>
[Display(Name = "DisplayName_EngineName", ResourceType = typeof(EvaluationStrings))]
public string EngineName
{
get;
set;
}
/// <summary>
/// Gets or sets a list of available JS engines
/// </summary>
public IEnumerable<SelectListItem> AvailableEngineList
{
get;
set;
}
/// <summary>
/// Gets or sets a expression
/// </summary>
[Display(Name = "DisplayName_Expression", ResourceType = typeof(EvaluationStrings))]
[DataType(DataType.MultilineText)]
[Required(ErrorMessageResourceName = "ErrorMessage_FormFieldIsNotFilled", ErrorMessageResourceType = typeof(EvaluationStrings))]
[StringLength(1000000, ErrorMessageResourceName = "ErrorMessage_FormFieldValueTooLong", ErrorMessageResourceType = typeof(EvaluationStrings))]
public string Expression
{
get;
set;
}
/// <summary>
/// Gets or sets a result of evaluation
/// </summary>
public JsEvaluationResultViewModel Result
{
get;
set;
}
/// <summary>
/// Constructs an instance of JS evaluation view model
/// </summary>
public JsEvaluationViewModel()
{
EngineName = string.Empty;
AvailableEngineList = new List<SelectListItem>();
Expression = string.Empty;
Result = null;
}
}
}