public ActionResult Edit(StocktakingPlanModel model) { model.EditedBy = _context.CurrentAccount.AccountId; model.Editor = _context.CurrentAccount.NickName; _stocktakingPlanFacade.Edit(model); return(Json(new { success = true })); }
public void Create(StocktakingPlanModel model) { var entity = model.MapTo <StocktakingPlan>(); entity.CreatedBy = model.EditedBy; entity.CreatedByName = model.Editor; entity.UpdatedBy = model.EditedBy; entity.UpdatedByName = model.Editor; entity.Code = _billService.GenerateNewCode(BillIdentity.StoreStocktakingPlan); _service.ValidatePlan(entity); _service.ValidatePlanDate(entity); _db.Insert(entity); _db.SaveChange(); }
public void Edit(StocktakingPlanModel model) { var entity = _db.Table.Find <StocktakingPlan>(model.Id); var oldStocktakingDate = entity.StocktakingDate; entity = model.MapTo <StocktakingPlan>(entity); entity.UpdatedBy = model.EditedBy; entity.UpdatedByName = model.Editor; entity.UpdatedOn = DateTime.Now; _service.ValidatePlan(entity); if (oldStocktakingDate != entity.StocktakingDate) { _service.ValidatePlanDate(entity); } _db.Update(entity); _db.SaveChange(); }