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