public void AddDropDown(DropDownBase model) { if (String.IsNullOrEmpty(model.Id)) { model.GenerateId(); } Add <DropDownBase>(model, model.GetType().Name, out var response); }
public static DropDownItems GetDropDownItems(List <string> pList = null) { var oRtn = new DropDownItems { DropDownBase.GetEmptyItem(DropDownBase.EmptyItem.Select_String) }; if (pList != null) { oRtn.AddRange(pList.Select((t, i) => new DropDownItem((i + 1).ToString(), t))); } return(oRtn); }
public static DropDownPostModel ConvertToPassingModel(this DropDownBase input) { var result = new DropDownPostModel(); var resultProperty = result.GetType().GetProperties().Where(b => b.BaseProperty()).ToList(); var properties = input.GetType().GetProperties(); foreach (var p in properties) { if (p.BaseProperty()) { var baseP = resultProperty.Where(b => b.Name == p.Name).FirstOrDefault(); baseP.SetValue(result, p.GetValue(input)); continue; } if (p.SkippedProperty()) { continue; } result.Properties.Add(p.GetContentPropertyByPropertyInfo(input)); } return(result); }
public void RemoveDropDown(DropDownBase model) { Remove <DropDownBase>(model, model.GetType().Name, model.Id); }
public void UpdateDropDown(DropDownBase model, IEnumerable <string> ignoreKeys = null, IEnumerable <string> takeKeys = null) { Update <DropDownBase>(model, model.Id, model.GetType().Name, ignoreKeys, takeKeys, out var response); }