private static Bank getEntityByModel(BankModel model) { if (model == null) return null; Bank entity = new Bank(); if (model.Id == 0) { entity.CompanyId = AuthenticationHelper.CompanyId.Value; entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; } else { entity.CompanyId = model.CompanyId; entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; } entity.BankName = model.BankName; entity.EndDate = model.EndDate; entity.Id = model.Id; entity.Remarks = model.Remarks; entity.SOBId = model.SOBId; entity.StartDate = model.StartDate; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return entity; }
public ActionResult Edit(BankModel model) { if (ModelState.IsValid) { string result = BankHelper.SaveBank(model); return RedirectToAction("Index"); } return View(model); }
public static string SaveBank(BankModel model) { if (model.Id > 0) return service.Update(getEntityByModel(model)); else return service.Insert(getEntityByModel(model)); }
public static BankModel GetBank(string bankId) { BankModel bank = new BankModel(service .GetSingle(bankId, AuthenticationHelper.CompanyId.Value)); return bank; }
public ActionResult Create() { BankModel bank = new BankModel(); bank.SOBId = SessionHelper.SOBId; return View(bank); }