public async Task <IActionResult> Delete(int id) { var food = await db.Foods.FindAsync(id); if (food == default(Food)) { return(NotFound()); } db.Remove(food); await db.SaveChangesAsync(); return(Ok(food.Id)); }
public void Remove(Food food) { FoodContext.Remove(food); FoodContext.SaveChanges(); }