示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Login,Password")] Account account)
        {
            if (id != account.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(account);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountExists(account.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Users, "Id", "Address", account.Id);
            return(View(account));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,PaymentAmount,UserId")] DebtPayment debtPayment)
        {
            if (id != debtPayment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(debtPayment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DebtPaymentExists(debtPayment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Address", debtPayment.UserId);
            return(View(debtPayment));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Patronymic,Email,Address,Phone,ProbabilityOfInsolvency,TypeOfUser")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,TypeOfLoanRate,Percent")] TypeOfLoan typeOfLoan)
        {
            if (id != typeOfLoan.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeOfLoan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeOfLoanExists(typeOfLoan.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeOfLoan));
        }
示例#5
0
        public async Task <IActionResult> Edit(int id,
                                               [Bind("Id,DateOfApplicationSubmission,LoanSize,Status,UserId,TypeOfLoanId")]
                                               SubmittedApplication submittedApplication)
        {
            if (submittedApplication.Status == "In review")
            {
                if (id != submittedApplication.Id)
                {
                    return(NotFound());
                }

                if (ModelState.IsValid)
                {
                    try
                    {
                        _context.Update(submittedApplication);
                        await _context.SaveChangesAsync();
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!SubmittedApplicationExists(submittedApplication.Id))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                    return(RedirectToAction(nameof(Index)));
                }
            }
            else if (submittedApplication.Status == "Approved")
            {
            }

            ViewData["TypeOfLoanId"] = new SelectList(_context.TypeOfLoans, "Id", "TypeOfLoanRate", submittedApplication.TypeOfLoanId);
            ViewData["UserId"]       = new SelectList(_context.Users, "Id", "Address", submittedApplication.UserId);
            return(View(submittedApplication));
        }