public ActionResult Index(int menuAddressId, int languageId) { PageFactoryDomain _pfd = new PageFactoryDomain(_db); ////获取控件信息 ViewBag.ControlList = _pfd.GetControlInfoList(); //获取所有的布局文件路径 ViewBag.LayoutPathList = _pfd.GetLayoutPathList; //当前菜单地址ID ViewBag.menuAddressId = menuAddressId; //当前语言ID ViewBag.languageId = languageId; //当前菜单名称和当前语言 var mNameAndLName = GetMenuNameAndLanguageNameById(menuAddressId, languageId); //菜单名称 ViewBag.menuName = mNameAndLName.Key; //当前语言 ViewBag.languageName = mNameAndLName.Value; //X6数据API ViewBag.apiTypeList = _db.Queryable <SysBest_DataApiType>().ToList(); Expression <Func <SysBest_PageContent, bool> > whereExpress = it => it.AddressId == menuAddressId && it.LanguageId == languageId; var isEdit = _db.Queryable <SysBest_PageContent>().Any(whereExpress); if (isEdit) { var data = _db.Queryable <SysBest_PageContent>().FirstOrDefault(whereExpress); return(View(data)); } else { return(View()); } }
public JsonResult SaveAttrsAndEvents(string htmlId, int addressId, int languageId, string category, string eleName, int?ApiId, string Description) { PageFactoryDomain _pfd = new PageFactoryDomain(_db); //允许Form有特殊字符 如 < ,等 RequestToModel.SetIsUnvalidatedFrom = key => { var val = Request.Unvalidated.Form.GetValues(key); if (val.IsNullOrEmpty()) { return(null); } var formArray = val.Select(it => it == null ? it : it.Replace(",", RequestToModel.COMMAS)).ToArray(); return(string.Join(",", formArray)); }; //锁住静态对象 lock (RequestToModel.SetIsUnvalidatedFrom) { var elementType = _pfd.GetElementIdByCategory(category); SysBest_Element insObj = new SysBest_Element() { AddressId = addressId, CreateTime = DateTime.Now, ElementType = elementType, LanguageId = languageId, EleName = eleName, Html_Id = htmlId, ApiId = ApiId, Description = Description, Founder = "聪哥" }; //允许特殊字符 var formEvents = RequestToModel.GetListByForm <ElementEvent>("event."); var formAttrs = RequestToModel.GetListByForm <ElementAttr>("attr."); //用完清空 RequestToModel.SetIsUnvalidatedFrom = null; var reval = SaveAttrsAndEvents_temp(elementType, insObj, addressId, formAttrs, formEvents); ActionResultModel <string> model = new ActionResultModel <string>(); model.isSuccess = reval; return(Json(model)); } }