public void Save(BankViewModel bankViewModel) { Bank bank = new Bank(bankViewModel.Id) { Name=bankViewModel.Name, Code=bankViewModel.Code, Description=bankViewModel.Description, }; _bankRepository.Save(bank); }
public ActionResult EditBank(BankViewModel ctpvm) { try { _bankViewModelBuilder.Save(ctpvm); TempData["msg"] = "Bank Successfully Edited"; return RedirectToAction("ListBanks"); } catch (DomainValidationException dve) { ValidationSummary.DomainValidationErrors(dve,ModelState); return View(); } catch (Exception ex) { _log.Debug("Failed to edit bank" + ex.Message); _log.Error("Failed to edit bank" + ex.ToString()); return View(); } }
public ActionResult CreateBank(BankViewModel ctpvm) { try { ctpvm.Id = Guid.NewGuid(); _bankViewModelBuilder.Save(ctpvm); TempData["msg"] = "Bank Successfully Created"; return RedirectToAction("ListBanks"); } catch (DomainValidationException dve) { ValidationSummary.DomainValidationErrors(dve, ModelState); _log.Debug("Failed to create bank" + dve.Message); _log.Error("Failed to create bank" + dve.ToString()); return View(); } catch (Exception ex) { ViewBag.msg = ex.Message; _log.Debug("Failed to create bank" + ex.Message); _log.Error("Failed to create bank" + ex.ToString()); return View(); } }