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));
        }
Exemple #2
0
 public void Remove(Food food)
 {
     FoodContext.Remove(food);
     FoodContext.SaveChanges();
 }