public void CreateDish(Dish dish) { using (var context = new LunchDbContext()) { context.Dishes.Add(dish); context.SaveChanges(); } }
public void CreateDish(Dish dish) { using (var context = new LunchDbContext()) { context.Dishes.Add(dish); context.SaveChanges(); } }
public int Save(Order order) { using (var context = new LunchDbContext()) { context.Orders.Add(order); context.SaveChanges(); } return order.Id; }
public int Save(Order order) { using (var context = new LunchDbContext()) { context.Orders.Add(order); context.SaveChanges(); } return(order.Id); }
public void UpdateDish(Dish dish) { using (var context = new LunchDbContext()) { var original = context.Dishes.Find(dish.Id); if (original == null) { throw new InvalidOperationException(); } context.Entry(original).CurrentValues.SetValues(dish); context.SaveChanges(); } }
public void UpdateDish(Dish dish) { using (var context = new LunchDbContext()) { var original = context.Dishes.Find(dish.Id); if (original == null) { throw new InvalidOperationException(); } context.Entry(original).CurrentValues.SetValues(dish); context.SaveChanges(); } }