Example #1
0
        static SelectList ToSelectList(Type typeEnum, int?selectedValue, KeyValueVm defaultOption)
        {
            var enumCollection = Enum
                                 .GetValues(typeEnum)
                                 .Cast <Enum>()
                                 .Select(r => new KeyValueVm(r.ToString("d"), r.ToLocalization(), selectedValue.HasValue));

            return(ItemToSelectList(enumCollection, "Value", "Text", selectedValue.HasValue ? selectedValue.ToString() : string.Empty, defaultOption));
        }
 public IncOptional(KeyValueVm value)
     : this(new[] { value })
 {
 }
Example #3
0
 protected bool Equals(KeyValueVm other)
 {
     return(this.IsReferenceEquals(other) && GetHashCode().Equals(other.GetHashCode()));
 }
Example #4
0
 public static SelectList ToSelectList(this Type typeEnum, Enum selectedValue = null, KeyValueVm defaultOption = null)
 {
     return(ItemToSelectList(typeEnum.ToKeyValueVm(), "Value", "Text", selectedValue.With(r => r.ToString()), defaultOption));
 }