28 lines
688 B
C#
28 lines
688 B
C#
using OF_DL.Models.Dtos.Subscriptions;
|
|
using OF_DL.Models.Entities.Subscriptions;
|
|
|
|
namespace OF_DL.Models.Mappers;
|
|
|
|
public static class SubscriptionsMapper
|
|
{
|
|
public static Subscriptions FromDto(SubscriptionsDto? dto)
|
|
{
|
|
Subscriptions mapped = new() { HasMore = dto?.HasMore ?? false };
|
|
|
|
if (dto?.List == null)
|
|
{
|
|
return mapped;
|
|
}
|
|
|
|
foreach (ListItemDto entry in dto.List)
|
|
{
|
|
mapped.List.Add(MapList(entry));
|
|
}
|
|
|
|
return mapped;
|
|
}
|
|
|
|
private static ListItem MapList(ListItemDto dto) =>
|
|
new() { Id = dto.Id, Username = dto.Username ?? string.Empty, IsRestricted = dto.IsRestricted };
|
|
}
|