public void AddOrUpdate(Meal meal) { var mealToSave = Context.Meals.SingleOrDefault(m => m.MealId == meal.MealId); if (mealToSave != null) { Context.Entry(mealToSave).CurrentValues.SetValues(meal); } else { Context.Meals.Add(meal); } Context.SaveChanges(); }
public void Save() { mealsContext.SaveChanges(); }