public ActionResult SubmitFormDeatil(BusniessListDeatilEntity entity, string keyValue, string Title = "", int?OrderBy = null) { RepositoryManager manager = new RepositoryManager(); if (string.IsNullOrWhiteSpace(keyValue)) { if (entity.FKID == null || entity.FKID == 0) { BusniessListEntity busniess = new BusniessListEntity(); busniess.CreateDateTime = DateTime.Now; busniess.CreateUserName = User.Identity.Name; busniess.Title = Title; busniess.OrderBy = OrderBy; manager.Add <BusniessListEntity>(busniess); entity.FKID = busniess.PKID; LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(busniess), Author = User.Identity.Name, Operation = "新增业务", ObjectType = "OWNBCON" }); } entity.CreateDateTime = DateTime.Now; entity.CreateUserName = User.Identity.Name; manager.Add <BusniessListDeatilEntity>(entity); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(entity), Author = User.Identity.Name, Operation = "新增业务内容", ObjectType = "OWNBCON" }); return(Content(JsonConvert.SerializeObject(new { state = "success", message = "操作成功", data = entity.FKID }))); } else { entity.PKID = Convert.ToInt32(keyValue); entity.UpdateDateTime = DateTime.Now; entity.UpdateUserName = User.Identity.Name; var beforeEntity = manager.GetEntity <BusniessListDeatilEntity>(entity.PKID); manager.Update <BusniessListDeatilEntity>(entity); LoggerManager.InsertOplog(new ConfigHistory() { BeforeValue = JsonConvert.SerializeObject(beforeEntity), AfterValue = JsonConvert.SerializeObject(entity), Author = User.Identity.Name, Operation = "更新业务内容", ObjectType = "OWNBCON" }); return(Content(JsonConvert.SerializeObject(new { state = "success", message = "操作成功", data = "" }))); } }
public ActionResult SubmitForm(BusniessListEntity entity) { RepositoryManager manager = new RepositoryManager(); entity.UpdateDateTime = DateTime.Now; entity.UpdateUserName = User.Identity.Name; var beforeEntity = manager.GetEntity <BusniessListEntity>(entity.PKID); manager.Update <BusniessListEntity>(entity); LoggerManager.InsertOplog(new ConfigHistory() { BeforeValue = JsonConvert.SerializeObject(beforeEntity), AfterValue = JsonConvert.SerializeObject(entity), Author = User.Identity.Name, Operation = "更新业务", ObjectType = "OWNBCON" }); return(Content(JsonConvert.SerializeObject(new { state = "success", message = "操作成功", data = "" }))); }