示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }