public static void UpdateAndSave(DITestContext context, object originalObject, object updatedObject, string[] collectionKeys) { context.Entry(originalObject).CurrentValues.SetValues(updatedObject); foreach (var prop in originalObject.GetType().GetProperties()) { context.Entry(originalObject).Property(prop.Name).IsModified = collectionKeys.Contains(prop.Name); } context.SaveChanges(); }
public void Save(LargeObjectDTO largeObjectDTO) { context.Set <LargeObjectDTO>().AddOrUpdate(largeObjectDTO); context.SaveChanges(); }
public SaleOrderItemDTO Save(SaleOrderItemDTO SaleOrderItemDTO) { context.Set <SaleOrderItemDTO>().AddOrUpdate(SaleOrderItemDTO); context.SaveChanges(); return(SaleOrderItemDTO); }