public ActionResult DocTypeEditModule(string id, bool ischildren) { ViewBag.DocumentTypeList = DocumentTypeDAL.Query(w => w.Status == 1).list.Select(s => new SelectListItem { Text = s.TypeName, Value = s.ID.ToString() }).ToList(); DocumentType model = new DocumentType(); if (ischildren) { if (!string.IsNullOrEmpty(id)) { model.UpID = Convert.ToInt32(id); } } else { if (!string.IsNullOrEmpty(id)) { int _id = Convert.ToInt32(id); model = DocumentTypeDAL.GetByOne(w => w.ID == _id); } } return(View(model)); }
public IActionResult DocTypeList(string searchContent, string seniorQueryJson, int page = 1, int limit = 10) { DocumentType model = null; if (!string.IsNullOrWhiteSpace(seniorQueryJson)) { model = Newtonsoft.Json.JsonConvert.DeserializeObject <DocumentType>(seniorQueryJson); } Expression <Func <DocumentType, bool> > predicate = i => 1 == 0; var searchPredicate = PredicateExtensions.True <DocumentType>(); if (model != null) { searchPredicate = searchPredicate.And(u => u.Status == 1); } var contents = DocumentTypeDAL.Query(searchPredicate); return(Json(new DataPage <DocumentType> { code = "0", msg = "", count = contents.count, data = contents.list })); }
//[ValidateAntiForgeryToken] public ActionResult DocTypeDelete(int id, IFormCollection collection) { var resdata = AutoException.Excute <long>((result) => { if (!DocumentTypeDAL.Delete(id)) { throw new Exception("数据删除异常,ID:" + id); } }, false); return(Json(resdata)); }
// GET: Documents public IActionResult Index(int id = 1) { var typeList = DocumentTypeDAL.Query(d => d.ID != 0).list; var contentlist = DocumentContentDAL.Query(d => d.Status == 1).list; //适应两层结构即可 var query = (from p in typeList where p.UpID == null || p.UpID == 0 select new TreeData(p, typeList).AddChildrens(GetContentTreeData(p.ID, contentlist), (tid) => GetContentTreeData(tid, contentlist))).ToList(); ViewBag.DocumentList = query; ViewBag.DocID = id; return(View()); }
//[ValidateAntiForgeryToken] public ActionResult DocTypeUpdate([FromBody] DocumentType model) { var resdata = AutoException.Excute <bool>((result) => { model.UpdateBy = "admin"; model.UpdateDt = DateTime.Now; result.Data = DocumentTypeDAL.Update(model); if (result.Data == false) { throw new Exception("数据新增异常,JSON:" + Newtonsoft.Json.JsonConvert.SerializeObject(model)); } }, false); return(Json(resdata)); }
public IActionResult DocType() { DocumentType model = new DocumentType(); ViewBag.TypeList = DocumentTypeDAL.Query(w => w.Status == 1).list.Select(s => new DocumentTypeTreeNode { id = s.ID.ToString(), pid = (s.UpID ?? 0).ToString(), title = s.TypeName, tag = s.Tag, createdt = s.CreateDt }).ToList(); return(View(model)); }
public ActionResult DocContentEditModule(string id) { ViewBag.DocumentTypeList = DocumentTypeDAL.Query(w => w.Status == 1).list.Select(s => new SelectListItem { Text = s.TypeName, Value = s.ID.ToString() }).ToList(); DocumentContent model = new DocumentContent() { OriginType = 0 }; if (!string.IsNullOrEmpty(id) && id != "0") { int _id = Convert.ToInt32(id); model = DocumentContentDAL.GetByOne(w => w.ID == _id); } return(View(model)); }