public async Task <IActionResult> Create([Bind("Id,Description")] Tag tag) { if (ModelState.IsValid) { _context.Add(tag); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tag)); }
public async Task <IActionResult> Create([Bind("ProductId,CategoryId,ProductName,Price,ProductDescription")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "Name", product.CategoryId); return(View(product)); }