public async Task <IActionResult> Create([Bind("FirstName,LastName,BirthDate,Id")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Details), customer.Id));
            }
            return(View(customer));
        }