public static DTO.PricingEverydayResult ToDto(this Display.PricingEverydayResult displayEntity) { var driverGroups = new List <DTO.PricingResultDriverGroup>(); foreach (Display.PricingResultDriverGroup group in displayEntity.Groups) { driverGroups.Add(group.ToDto()); } var priceLists = new List <DTO.PricingEverydayResultPriceList>(); foreach (Display.PricingEverydayResultPriceList priceList in displayEntity.PriceLists) { priceLists.Add(priceList.ToDto()); } var dto = new DTO.PricingEverydayResult( displayEntity.SkuId, displayEntity.SkuName, displayEntity.SkuTitle, driverGroups, priceLists); return(dto); }
public static Display.PricingEverydayResult ToDisplayEntity(this DTO.PricingEverydayResult dto) { var displayEntity = new Display.PricingEverydayResult(); displayEntity.SkuId = dto.SkuId; displayEntity.SkuName = dto.SkuName; displayEntity.SkuTitle = dto.SkuTitle; if (dto.Groups != null) { foreach (DTO.PricingResultDriverGroup group in dto.Groups) { displayEntity.Groups.Add(group.ToDisplayEntity()); } } return(displayEntity); }