public async Task <IActionResult> DeleteRestaurant(Restarant restaurant) { _context.Restaurants.Remove(restaurant); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Home")); }
public async Task <IActionResult> EditRestaurant(Restarant restaurant) { var entity = await _context.Restaurants.FindAsync(restaurant.Id); if (entity == null) { await _context.Restaurants.AddAsync(restaurant); } else { entity.Name = restaurant.Name; } await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Home")); }