Exemple #1
0
        public async Task <IActionResult> Index(Product product)
        {
            if (ModelState.IsValid)
            {
                db.Add(product);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Tablelist)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Create([Bind("ProductId,ProductName,ProductPrice,UnitStock")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

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