Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,CardName,PromotionalMessage,ImageURL,APR,MinimumAge,MinimumEarnings,MaximumEarnings")] CreditCard creditCard)
        {
            if (ModelState.IsValid)
            {
                _context.Add(creditCard);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(creditCard));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,DOB,Income,CardsShown")] ApplicationForm applicationForm)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicationForm);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicationForm));
        }
        public async Task <IActionResult> FormResponse(ApplicationForm form)
        {
            //add new form to database
            ApplicationResult result = new ApplicationResult(form);

            result.Cards = GetSuitableCards(form);
            foreach (ClientCreditCard c in result.Cards)
            {
                form.CardsShown += c.ID + ",";
            }
            _context.Add(form);
            await _context.SaveChangesAsync();

            return(View(result));
        }