public async Task <IActionResult> Create([Bind("ID,Name,Number,Price")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("ID,ShoppingDate,Store,Sum")] ShoppingDay shoppingDay) { if (ModelState.IsValid) { _context.Add(shoppingDay); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shoppingDay)); }