public ActionResult Create(TraceLogViewModel model) { ServiceResult result = new ServiceResult(); if (ModelState.IsValid) { try { TraceLogService.Create(model); result.Message = "添加TraceLog成功!"; LogHelper.WriteLog("添加TraceLog成功"); } catch (Exception ex) { result.Message = Utilities.GetInnerMostException(ex); result.AddServiceError(result.Message); LogHelper.WriteLog("添加TraceLog错误", ex); } } else { result.Message = "请检查表单是否填写完整!"; result.AddServiceError("请检查表单是否填写完整!"); } return Json(result); }
public TraceLog Create(TraceLogViewModel model) { var entity = new TraceLog(); entity.CompanyID=model.CompanyID; entity.AddTime=model.AddTime; entity.Content=model.Content; entity.Comment=model.Comment; entity.CommentTitme=model.CommentTitme; entity.AddUser=model.AddUser; entity.RelationID=model.RelationID; db.Add<TraceLog>(entity); db.Commit(); return entity; }
public ActionResult Edit(int ID) { var entity = TraceLogService.GetALL().Single(x => x.ID == ID); var model = new TraceLogViewModel() { ID = entity.ID, CompanyID = entity.CompanyID, AddTime = entity.AddTime, Content = entity.Content, Comment = entity.Comment, CommentTitme = entity.CommentTitme, AddUser = entity.AddUser, RelationID = entity.RelationID, }; return PartialView(model); }
public ActionResult Create() { var model = new TraceLogViewModel(); return PartialView(model); }
public TraceLog Update(TraceLogViewModel model) { var entity = Find(model.ID); db.Attach<TraceLog>(entity); entity.CompanyID=model.CompanyID; entity.AddTime=model.AddTime; entity.Content=model.Content; entity.Comment=model.Comment; entity.CommentTitme=model.CommentTitme; entity.AddUser=model.AddUser; entity.RelationID=model.RelationID; db.Commit(); return entity; }