public ActionResult Credit(AccountCreditForm form) { if (ModelState.IsValid) { accountService.Credit(form.AccountId, form.CreditAmount); return(RedirectToAction("Index")); } return(View("Credit", form)); }
public ActionResult Credit(AccountCreditForm form) { if (ModelState.IsValid) { try { accountModule.Credit(form.AccountId, form.CreditAmount); unitOfWork.Commit(); return(RedirectToAction("Index")); } catch { unitOfWork.Rollback(); throw; } } return(View("Credit", form)); }
public ActionResult Credit(AccountCreditForm form) { if (ModelState.IsValid) { try { Account account = accountRepository.Get(form.AccountId); account.Credit(form.AccountId, form.CreditAmount); unitOfWork.Commit(); return(RedirectToAction("Details", new { id = account.Id })); } catch { unitOfWork.Rollback(); throw; } } return(View("Credit", form)); }