Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,MiddleNameInitial,LastName,Address,PhoneNumber,Email,DOB,UserName,Password")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                var Id = customer.Id;
                return(RedirectToAction("Details", new { @id = Id }));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("ID,AccountNumber,AccountBalance,AccountType,Activated,CustomerID,MaturityDate,InterestRate")] CheckingAccount checkingAccount)
        {
            if (ModelState.IsValid)
            {
                _context.Add(checkingAccount);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerID"] = new SelectList(_context.Customers, "Id", "Address", checkingAccount.CustomerID);
            return(View(checkingAccount));
        }