You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using NzbDrone.Core.Tv;
|
|
namespace NzbDrone.Api.Series
|
|
{
|
|
public class SeasonResource
|
|
{
|
|
public int SeasonNumber { get; set; }
|
|
public bool Monitored { get; set; }
|
|
public SeasonStatisticsResource Statistics { get; set; }
|
|
}
|
|
|
|
public static class SeasonResourceMapper
|
|
{
|
|
public static SeasonResource ToResource(this Season model)
|
|
{
|
|
if (model == null) return null;
|
|
|
|
return new SeasonResource
|
|
{
|
|
SeasonNumber = model.SeasonNumber,
|
|
Monitored = model.Monitored
|
|
};
|
|
}
|
|
|
|
public static Season ToModel(this SeasonResource resource)
|
|
{
|
|
if (resource == null) return null;
|
|
|
|
return new Season
|
|
{
|
|
SeasonNumber = resource.SeasonNumber,
|
|
Monitored = resource.Monitored
|
|
};
|
|
}
|
|
|
|
public static List<SeasonResource> ToResource(this IEnumerable<Season> models)
|
|
{
|
|
return models.Select(ToResource).ToList();
|
|
}
|
|
|
|
public static List<Season> ToModel(this IEnumerable<SeasonResource> resources)
|
|
{
|
|
return resources?.Select(ToModel).ToList() ?? new List<Season>();
|
|
}
|
|
}
|
|
}
|