コード例 #1
0
        public ActionResult Credit(AccountCreditForm form)
        {
            if (ModelState.IsValid)
            {
                accountService.Credit(form.AccountId, form.CreditAmount);
                return(RedirectToAction("Index"));
            }

            return(View("Credit", form));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }