Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CardName,PromotionalMessage,ImageURL,APR,MinimumAge,MinimumEarnings,MaximumEarnings")] CreditCard creditCard)
        {
            if (id != creditCard.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(creditCard);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CreditCardExists(creditCard.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(creditCard));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,DOB,Income,CardsShown")] ApplicationForm applicationForm)
        {
            if (id != applicationForm.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(applicationForm);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApplicationFormExists(applicationForm.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicationForm));
        }