public static SelectList GetBySlug(string slug, bool useDescriptionAsText = false) { BaseModelContext <FieldOptionModel> db = new BaseModelContext <FieldOptionModel>(); var query = db.Models.Where(c => c.Slug == slug); return(FieldOptionModelContext.MakeList(query.FirstOrDefault(), useDescriptionAsText)); }
public static SelectList GetByRegistration(string modelField, bool useDescriptionAsText = false) { BaseModelContext <FieldOptionModelFieldModel> db = new BaseModelContext <FieldOptionModelFieldModel>(); var query = db.Models.Where(c => c.ModelField == modelField); return(FieldOptionModelContext.MakeList((query.FirstOrDefault() != null ? query.FirstOrDefault().FieldOption : null), useDescriptionAsText)); }
public static SelectList GetByName(string name, bool useDescriptionAsText = false) { List <SelectListItem> listItems = new List <SelectListItem>(); BaseModelContext <FieldOptionModel> db = new BaseModelContext <FieldOptionModel>(); var query = db.Models.Where(c => c.Name == name); return(FieldOptionModelContext.MakeList(query.FirstOrDefault(), useDescriptionAsText)); }