public override void Replace(Detail oldEntity, Detail newEntity) { SharedService.CopyEntity <Detail>(oldEntity, newEntity); if (newEntity.Material != null) { oldEntity.Material = Context.Material.SingleOrDefault(currentMaterial => currentMaterial.Id == newEntity.Material.Id); } Save(); }
public override void Replace(Product oldEntity, Product newEntity) { SharedService.CopyEntity <Product>(oldEntity, newEntity); if (newEntity.Detail != null) { int[] ids = newEntity.Detail.Select(currentDetail => currentDetail.Id).ToArray(); oldEntity.Detail = Context.Detail.Where(currentDetail => ids.Contains(currentDetail.Id)).ToList(); } Save(); }
public virtual void Replace(T oldEntity, T newEntity) { SharedService.CopyEntity <T>(oldEntity, newEntity); Save(); }