1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 10:32:35 +01:00
Radarr/NzbDrone.Api/Episodes/EpisodeModule.cs

29 lines
817 B
C#
Raw Normal View History

2013-03-02 20:13:23 +01:00
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using AutoMapper;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Episodes
{
public class EpisodeModule : NzbDroneApiModule
{
private readonly EpisodeService _episodeService;
public EpisodeModule(EpisodeService episodeService)
: base("/episodes")
{
_episodeService = episodeService;
Get["/{seriesId}"] = x => GetEpisodesForSeries(x.SeriesId);
}
private Response GetEpisodesForSeries(int seriesId)
{
var episodes = _episodeService.GetEpisodeBySeries(seriesId);
return Mapper.Map<List<Episode>, List<EpisodeResource>>(episodes).AsResponse();
}
}
}