public override JsonResult InsertTree() { Guid parentId = Guid.Empty; if (!Guid.TryParse(Request["pid"].ToString(), out parentId) || Request["name"] == null) { throw new NopException("参数不合法"); } string name = Request["name"].ToString(); if (dataDictionaryService.AlreadyExists(name, parentId, Guid.Empty)) { return(Json(new AjaxResult() { Result = Result.Error, Message = "键名重复" }, JsonRequestBehavior.AllowGet)); } else { var entity = new DataDictionary() { Name = name, ParentId = parentId, CreatorId = CurrentUser.Id }; dataDictionaryService.Add(entity); return(Json(new TreeAjaxResult() { Result = Result.Success, CurrentNodeId = entity.Id.ToString() }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(DataDictionary model) { model.ActionOperationType = EActionOperationType.Create; if (ModelState.IsValid) { DataDictionaryService service = new DataDictionaryService(); service.Add(model); return RedirectToAction("Index"); } this.LoadEditViewBag(model); return View("Create",model); }