public void UpdateCustomer(Lib.Customer customer) { //_db.Entry(customer).State = EntityState.Modified; // calling Update would mark every property as Modified. // this way will only mark the changed properties as Modified. _db.Entry(_db.Customer.Find(customer.Id)).CurrentValues.SetValues(Mapper.Map(customer)); }
public void UpdateOrder(Order order) { _db.Entry(_db.StoreOrder.Find(order.OrderId)).CurrentValues.SetValues(Mapper.Map(order)); }