Exemplo n.º 1
0
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, BankModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                var bank = new Bank
                {
                    Name = model.Name,
                    BankAccNo = model.BankAccNo,
                    UpdateOn = DateTime.Now,
                    Remark = model.Remark
                };

                if (_workContext.CurrentAccount != null)
                {
                    bank.UpdateBy = _workContext.CurrentAccount.Email;
                    model.UpdateBy = _workContext.CurrentAccount.Email;
                }

                _bankService.InsertBank(bank);

                model.Id = bank.Id;
                model.UpdateOn = DateTime.Now;
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
Exemplo n.º 2
0
 public ActionResult Delete([DataSourceRequest] DataSourceRequest request, BankModel model)
 {
     if (model != null)
     {
         var bank = _bankService.GetBankById(model.Id);
         _bankService.DeleteBank(bank);
     }
     return Json(new[] { model }.ToDataSourceResult(request, ModelState));
 }
Exemplo n.º 3
0
 public ActionResult Edit([DataSourceRequest] DataSourceRequest request, BankModel model)
 {
     if (model != null && ModelState.IsValid)
     {
         var bank = _bankService.GetBankById(model.Id);
         bank.Name = model.Name;
         bank.Remark = model.Remark;
         bank.UpdateOn = DateTime.Now;
         if (_workContext.CurrentAccount != null)
         {
             bank.UpdateBy = _workContext.CurrentAccount.Email;
             model.UpdateBy = _workContext.CurrentAccount.Email;
         }
         _bankService.UpdateBank(bank);
         model.UpdateOn = DateTime.Now;
     }
     return Json(new[] { model }.ToDataSourceResult(request, ModelState));
 }