using CoreProfilerExample.Repository.Models.DataModels; using CoreProfilerExample.Service.Models.Dtos; namespace CoreProfilerExample.Service.Extensions { public static class MapperExtension { public static async Task ToDtoAsync(this Task> task) { var dataModels = await task; return new GetWeatherForecastDto { WeatherForecasts = dataModels.Select(model => model.ToDto()), }; } public static GetWeatherForecastItemDto ToDto(this WeatherForecastDataModel dataModel) { return new GetWeatherForecastItemDto { Date = dataModel.Date, Summary = dataModel.Summary, TemperatureC = dataModel.TemperatureC, }; } } }