public void Update(Order order) { //In case the new guy on the team sends in a detached entity. if (this.Context.Entry(order).State == System.Data.EntityState.Detached) { this.Context.Entry(order).State = System.Data.EntityState.Modified; } else { //In MVC we're overwriting the object's properties with a timestamp. //The timestamp though is treated by EF as a computed field and only the original valyeds this.Context.Entry(order).Property(u => u.Timestamp).OriginalValue = order.Timestamp; } }
public void Delete(Order order) { Context.Orders.Remove(order); }
public void Create(Order entity) { Context.Orders.Add(entity); }