public ActionResult Create(AccountType accounttype) { if (ModelState.IsValid) { accountTypeRepository.InsertOrUpdate(accounttype); accountTypeRepository.Save(); return(RedirectToAction("Index")); } else { return(View()); } }
public void RegisterAccountType(CreateAccountTypeDto dto) { uow.Begin(); var accountType = new AccountType(dto.AccountTypeNumber, dto.Title); try { accountTypeRepository.Save(accountType); uow.Commit(); } catch (System.Exception ex) { uow.Rollback(); } }
public void Handle(RegisterAccountTypeCommand command) { uow.Begin(); var accounttype = new AccountType(command.AccountTypeNumber, command.Title); try { accountTypeRepository.Save(accounttype); uow.Commit(); } catch (System.Exception ex) { uow.Rollback(); } }
public IActionResult EditAccountType(AccountType model) { if (ModelState.IsValid) { _accountTypeRepo.Save(model); TempData["message"] = $"{model.Name} has been saved"; return(RedirectToAction("AccountTypes")); } else { if (model.ID == 0) { ViewBag.FormTitle = "Create Account Type"; } else { ViewBag.FormTitle = "Edit Account Type"; } return(View(model)); } }