Exemple #1
0
        public async Task <IActionResult> Create([Bind("CustomerID,Firstname,Lastname,Added,CreditLimit")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ProductID,Name,Price,Qty,Status")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }