public ActionResult AddAction(MenuAction model) { try { if (model != null) { if (MenuActionRepository.Add(model) != null) { LogRepository.Add(new EventLog() { Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "新增操作成功" }); return(Json(new { Success = true, Msg = "操作添加成功。" })); } } return(Json(new { Success = false, Msg = "添加失败,请重新提交。" })); } catch (Exception ex) { LogRepository.Add(new EventLog() { Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "新增操作失败" + ex.Message }); return(Json(new { Success = false, Msg = "添加失败," + ex.Message })); } }