public async Task <IActionResult> Edit(int id, [Bind("IdList,IdUser")] ShoppingListHistory shoppingListHistory) { if (id != shoppingListHistory.IdList) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shoppingListHistory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShoppingListHistoryExists(shoppingListHistory.IdList)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shoppingListHistory)); }
public async Task <IActionResult> Create([Bind("IdList,IdUser")] ShoppingListHistory shoppingListHistory) { if (ModelState.IsValid) { _context.Add(shoppingListHistory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shoppingListHistory)); }