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