Radarr/NzbDrone.Services.Api/DailySeries/DailySeriesModule.cs

35 lines
948 B
C#
Raw Normal View History

2013-01-29 01:07:18 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using NzbDrone.Services.Api.Extensions;
2013-01-29 01:07:18 +00:00
namespace NzbDrone.Services.Api.DailySeries
{
public class DailySeriesModule : NancyModule
{
private readonly DailySeriesRepository _dailySeriesProvider;
2013-01-29 01:07:18 +00:00
public DailySeriesModule(DailySeriesRepository dailySeriesProvider)
2013-01-29 01:07:18 +00:00
: base("/dailyseries")
{
_dailySeriesProvider = dailySeriesProvider;
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 _dailySeriesProvider.Public().AsResponse();
}
private Response OnGet(int seriesId)
{
return _dailySeriesProvider.IsDaily(seriesId).AsResponse();
}
}
}