1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 17:59:14 +00:00
Radarr/NzbDrone.Api/Episodes/EpisodeModule.cs
2013-03-02 11:13:39 -08:00

29 lines
No EOL
817 B
C#

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();
}
}
}