MireaBackend/Endpoint/Common/Services/PairPeriodTimeConverter.cs
Polianin Nikita 7b779463bb
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m51s
feat: add converter from Dto.PairPeriodTime toEnpoint.PairPeriodTime and vice versa
2024-05-28 06:59:28 +03:00

14 lines
749 B
C#

using Mirea.Api.Endpoint.Configuration.General.Settings;
using System.Collections.Generic;
using System.Linq;
namespace Mirea.Api.Endpoint.Common.Services;
public static class PairPeriodTimeConverter
{
public static Dictionary<int, Dto.Common.PairPeriodTime> ConvertToDto(this IDictionary<int, ScheduleSettings.PairPeriodTime> pairPeriod) =>
pairPeriod.ToDictionary(kvp => kvp.Key, kvp => new Dto.Common.PairPeriodTime { Start = kvp.Value.Start, End = kvp.Value.End });
public static Dictionary<int, ScheduleSettings.PairPeriodTime> ConvertFromDto(this IDictionary<int, Dto.Common.PairPeriodTime> pairPeriod) => pairPeriod.ToDictionary(kvp => kvp.Key, kvp => new ScheduleSettings.PairPeriodTime(kvp.Value.Start, kvp.Value.End));
}