public void SaveUpdatedGlass(Glass glass) { using (var context = new GlassContext()) { context.Entry(glass).State = EntityState.Modified; context.SaveChanges(); } }
public void SaveUpdatedOrder(Order order) { using (var context = new GlassContext()) { context.Entry(order).State = EntityState.Modified; context.SaveChanges(); } }
public void SaveUpdatedCustomer(Customer customer) { using (var context = new GlassContext()) { context.Entry(customer).State = EntityState.Modified; context.SaveChanges(); } }
//public Order GetOrderById(int id) //{ // using (var context = new GlassContext()) // { // Order order = context.OrderSet.Find(id); // Customer customer = GetCustomerById(order.CustomerId); // order.Customer = customer; // return order; // } //} public void DeleteOrder(int orderId) { using (var context = new GlassContext()) { var order = context.OrderSet.Find(orderId); context.Entry(order).State = EntityState.Deleted; context.SaveChanges(); } }
public void DeleteCustomer(int customerId) { using (var context = new GlassContext()) { var customer = context.CustomerSet.Find(customerId); context.Entry(customer).State = EntityState.Deleted; context.SaveChanges(); } }
public void DeleteGlass(int glassId) { using (var context = new GlassContext()) { var glass = context.GlassSet.Find(glassId); context.Entry(glass).State = EntityState.Deleted; context.SaveChanges(); } }