public static IResource <int> FromDto(ResourceDto dto) { if (dto == null) { throw new ArgumentNullException(nameof(dto)); } return(new Resource <int>( dto.Id, dto.Name, dto.IsExplicitTarget, dto.InterActivityAllocationType, dto.UnitCost, dto.DisplayOrder)); }
public static ResourceDto Copy(this ResourceDto resourceDto) { if (resourceDto == null) { throw new ArgumentNullException(nameof(resourceDto)); } return(new ResourceDto { Id = resourceDto.Id, Name = resourceDto.Name, IsExplicitTarget = resourceDto.IsExplicitTarget, InterActivityAllocationType = resourceDto.InterActivityAllocationType, UnitCost = resourceDto.UnitCost, DisplayOrder = resourceDto.DisplayOrder, ColorFormat = resourceDto.ColorFormat != null?resourceDto.ColorFormat.Copy() : new ColorFormatDto() }); }