public async Task <IActionResult> Edit(int id, [Bind("HotCoffeeID,HotCoffeeType,HotCoffeeName")] HotCoffee hotCoffee) { if (id != hotCoffee.HotCoffeeID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(hotCoffee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HotCoffeeExists(hotCoffee.HotCoffeeID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(hotCoffee)); }
public async Task <IActionResult> Create([Bind("HotCoffeeID,HotCoffeeType,HotCoffeeName")] HotCoffee hotCoffee) { if (ModelState.IsValid) { _context.Add(hotCoffee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hotCoffee)); }