public JsonResult Edit(MenuDto model) { string errs = GetModelStateError(); if (!string.IsNullOrEmpty(errs)) { return(Json(new OperateMessage <string>(OperateResult.Fail, true, errs))); } MenuDto currModel = _MenuAppService.Get(model.ID); if (currModel == null) { return(Json(new OperateMessage <string>(OperateResult.Fail, true, "修改失败,修改的内容不存在!"))); } currModel.Code = model.Code; currModel.LastUpdateTime = DateTime.Now; currModel.LastUpdateUserID = _currUser.ID; currModel.Icon = model.Icon; currModel.IsTopMenu = model.IsTopMenu; currModel.Name = model.Name; currModel.ParentId = model.ParentId; currModel.Remarks = model.Remarks; currModel.SerialNumber = model.SerialNumber; currModel.Type = model.Type; currModel.Url = model.Url; bool IsSucceed = _MenuAppService.Edit(currModel); if (IsSucceed) { return(Json(new OperateMessage <string>("/Menu/Index"))); } return(Json(new OperateMessage <string>(IsSucceed ? OperateResult.Success : OperateResult.Fail, true, IsSucceed ? "修改成功!" : "修改失败!"))); }
/// <summary> /// 新增或编辑功能 /// </summary> /// <param name="dto"></param> /// <returns></returns> public IActionResult Edit(MenuDto dto) { if (!ModelState.IsValid) { return(Json(new { Result = "Faild", Message = GetModelStateError() })); } if (dto.ID != Guid.Empty ? _menuAppService.Edit(dto) : _menuAppService.Create(dto)) { return(Json(new { Result = "Success" })); } return(Json(new { Result = "Faild" })); }