1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/Episodes/EpisodeModule.cs

29 lines
817 B
C#
Raw Normal View History

2013-03-02 22:13:23 +03: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();
}
}
}