public async Task <MenuAction> AddOrModifyMenuActionAsync(AddOrModifyMenuAction model, string sOperator) { MenuAction entityMenuAction; if (model.Id == 0) { entityMenuAction = _mapper.Map <MenuAction>(model); await _menuActionRepository.AppendAsync(entityMenuAction, sOperator); } else { entityMenuAction = await _menuActionRepository.SelectAsync(model.Id); if (entityMenuAction != null) { _mapper.Map(model, entityMenuAction); _menuActionRepository.Update(entityMenuAction, sOperator); } } return(entityMenuAction); }
public ActionResult UpdateAction(MenuAction model) { try { if (model != null) { if (MenuActionRepository.Update(model)) { LogRepository.Add(new EventLog() { Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "修改操作规则成功" }); return(Json(new { Success = true })); } } return(Json(new { Success = false, Message = "更新失败,参数有误。" })); } catch (Exception ex) { LogRepository.Add(new EventLog() { Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "修改操作规则失败" + ex.Message }); return(Json(new { Success = false })); } }