public ResolveInventoryDto(InventoryDetailDto detail, Guid?unexpectedReason = null, Guid?missingReason = null) { Id = detail.Id; // initialise arrays with no reasons FoundItemsExpected = detail.FoundItemsExpected.Select(i => new ResolveItemDto(i.Id)).ToList(); FoundItemsUnexpected = detail.FoundItemsUnexpected.Select(i => new ResolveItemDto(i.Id, i.ReasonId ?? unexpectedReason)).ToList(); MissingItems = detail.MissingItems.Select(i => new ResolveItemDto(i.Id, i.ReasonId ?? missingReason)).ToList(); }
public InventoryDetailDto(InventoryDetailDto dto) : base(dto) { if (dto == null) { return; } var properties = typeof(InventoryDetailDto).GetTypeInfo().DeclaredProperties; foreach (var property in properties) { var value = property.GetValue(dto); property.SetValue(this, value); } }