Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("ID,Name,Qty,UnitPrice")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,Name,Address,City,State,Zip,Phone")] Vendor vendor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vendor);
                await _context.SaveChangesAsync();

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