Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AccountName,IsActivated")] InternalAccountViewModel accountViewModel)
        {
            if (id != accountViewModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _gLAccountService.EditInternalAccountAsync(accountViewModel);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _gLAccountService.GLAccountExists(accountViewModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accountViewModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("GLAccountId,CustomerAccounts,InterestRate,AccountName,LinkedAccount,Principal,DurationYears,RepaymentFrequencyMonths,StartDate")] LoanAccountViewModel accountViewModel)
        {
            if (id != accountViewModel.GLAccountId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _gLAccountService.EditLoanAccountAsync(accountViewModel);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _gLAccountService.GLAccountExists(accountViewModel.GLAccountId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (Exception ex)
                {
                    ViewBag.Message = new StatusMessage
                    {
                        Message = ex.Message,
                        Type    = StatusType.Error
                    };
                    return(View(accountViewModel));
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accountViewModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,AccountName,IsActivated")] CustomerAccountViewModel accountViewModel)
        {
            if (id != accountViewModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _gLAccountService.EditCustomerAccountAsync(accountViewModel);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _gLAccountService.GLAccountExists(accountViewModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (Exception ex)
                {
                    ViewBag.Message = new StatusMessage
                    {
                        Message = ex.Message,
                        Type    = StatusType.Error
                    };
                    return(View(accountViewModel));
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accountViewModel));
        }