Пример #1
0
        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;
        }
Пример #2
0
 public ActionResult Edit(BankModel model)
 {
     if (ModelState.IsValid)
     {
         string result = BankHelper.SaveBank(model);
         return RedirectToAction("Index");
     }
     return View(model);
 }
Пример #3
0
 public static string SaveBank(BankModel model)
 {
     if (model.Id > 0)
         return service.Update(getEntityByModel(model));
     else
         return service.Insert(getEntityByModel(model));
 }
Пример #4
0
 public static BankModel GetBank(string bankId)
 {
     BankModel bank = new BankModel(service
         .GetSingle(bankId, AuthenticationHelper.CompanyId.Value));
     return bank;
 }
Пример #5
0
 public ActionResult Create()
 {
     BankModel bank = new BankModel();
     bank.SOBId = SessionHelper.SOBId;
     return View(bank);
 }