1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-07-03 00:47:10 +02:00
Files
Sonarr/NzbDrone.Api/Episodes/EpisodeModule.cs

31 lines
821 B
C#
Raw Normal View History

using System.Collections.Generic;
2013-05-30 17:12:20 -07:00
using NzbDrone.Api.REST;
2013-03-02 11:13:23 -08:00
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Episodes
{
2013-05-30 17:12:20 -07:00
public class EpisodeModule : NzbDroneRestModule<EpisodeResource>
2013-03-02 11:13:23 -08:00
{
2013-03-31 23:22:16 -07:00
private readonly IEpisodeService _episodeService;
2013-03-02 11:13:23 -08:00
2013-03-31 23:22:16 -07:00
public EpisodeModule(IEpisodeService episodeService)
2013-03-02 11:13:23 -08:00
: base("/episodes")
{
_episodeService = episodeService;
2013-05-30 17:12:20 -07:00
GetResourceAll = GetEpisodes;
2013-03-02 11:13:23 -08:00
}
2013-05-30 17:12:20 -07:00
private List<EpisodeResource> GetEpisodes()
2013-03-02 11:13:23 -08:00
{
2013-05-30 17:12:20 -07:00
var seriesId = (int?)Request.Query.SeriesId;
if (seriesId == null)
{
throw new BadRequestException("seriesId is missing");
}
return ToListResource(() => _episodeService.GetEpisodeBySeries(seriesId.Value));
2013-03-02 11:13:23 -08:00
}
}
}