1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 17:59:14 +00:00
Radarr/NzbDrone.Services.Api/DailySeries/DailySeriesModule.cs
2013-02-15 16:52:44 -08:00

37 lines
No EOL
999 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using NzbDrone.Services.Api.Extensions;
namespace NzbDrone.Services.Api.DailySeries
{
public class DailySeriesModule : NancyModule
{
private readonly DailySeriesRepository _dailySeriesRepository;
public DailySeriesModule(DailySeriesRepository dailySeriesRepository)
: base("/dailyseries")
{
_dailySeriesRepository = dailySeriesRepository;
Get["/"] = x => OnGet();
Get["/all"] = x => OnGet();
Get["/{Id}"] = x => OnGet((int)x.Id);
Get["/isdaily/{Id}"] = x => OnGet((int)x.Id);
}
private Response OnGet()
{
return _dailySeriesRepository.Public().AsResponse();
}
private Response OnGet(int seriesId)
{
var result = _dailySeriesRepository.Find(seriesId) != null;
return result.AsResponse();
}
}
}