public ProductModel Update(ProductModel updatedProductModel) { _ctx.ProductModels.Attach(updatedProductModel).State = EntityState.Modified; _ctx.Entry(updatedProductModel).Reference(pm => pm.ProductCategory).IsModified = true; _ctx.SaveChanges(); return(updatedProductModel); }
public Order Update(Order updatedOrder) { _ctx.Orders.Attach(updatedOrder).State = EntityState.Modified; _ctx.Entry(updatedOrder).Reference(o => o.Country).IsModified = true; _ctx.SaveChanges(); return(updatedOrder); }