1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-11 21:42:37 +01:00
Radarr/NzbDrone.Web/Controllers/UpcomingController.cs

134 lines
4.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
2011-03-23 08:06:22 +01:00
using System.Web.Mvc;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
using Telerik.Web.Mvc;
namespace NzbDrone.Web.Controllers
{
public class UpcomingController : Controller
{
2011-04-10 04:44:01 +02:00
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
private readonly SeriesProvider _seriesProvider;
2011-03-23 08:06:22 +01:00
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider, SeriesProvider seriesProvider)
2011-03-23 08:06:22 +01:00
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
_seriesProvider = seriesProvider;
2011-03-23 08:06:22 +01:00
}
//
// GET: /Upcoming/
public ActionResult Index()
{
return View();
}
[GridAction]
public ActionResult _AjaxBindingYesterday()
{
var upcomingDb = _upcomingEpisodesProvider.Yesterday();
var upcoming = new List<UpcomingEpisodeModel>();
foreach (var item in upcomingDb)
{
var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel
{
SeriesId = series.SeriesId,
EpisodeId = item.EpisodeId,
SeriesName = series.Title,
SeasonNumber = item.SeasonNumber,
EpisodeNumber = item.EpisodeNumber,
Title = item.Title,
Overview = item.Overview,
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
});
}
2011-04-10 04:44:01 +02:00
2011-03-23 08:06:22 +01:00
return View(new GridModel(upcoming));
}
[GridAction]
public ActionResult _AjaxBindingToday()
{
var upcomingDb = _upcomingEpisodesProvider.Today();
var upcoming = new List<UpcomingEpisodeModel>();
foreach (var item in upcomingDb)
{
var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel
{
SeriesId = series.SeriesId,
EpisodeId = item.EpisodeId,
SeriesName = series.Title,
SeasonNumber = item.SeasonNumber,
EpisodeNumber = item.EpisodeNumber,
Title = item.Title,
Overview = item.Overview,
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
});
}
2011-03-23 08:06:22 +01:00
return View(new GridModel(upcoming));
}
[GridAction]
public ActionResult _AjaxBindingTomorrow()
{
var upcomingDb = _upcomingEpisodesProvider.Tomorrow();
var upcoming = new List<UpcomingEpisodeModel>();
foreach (var item in upcomingDb)
{
var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel
{
SeriesId = series.SeriesId,
EpisodeId = item.EpisodeId,
SeriesName = series.Title,
SeasonNumber = item.SeasonNumber,
EpisodeNumber = item.EpisodeNumber,
Title = item.Title,
Overview = item.Overview,
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
});
}
return View(new GridModel(upcoming));
}
2011-03-23 08:06:22 +01:00
[GridAction]
public ActionResult _AjaxBindingWeek()
{
var upcomingDb = _upcomingEpisodesProvider.Week();
var upcoming = new List<UpcomingEpisodeModel>();
foreach (var item in upcomingDb)
{
var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel
{
SeriesId = series.SeriesId,
EpisodeId = item.EpisodeId,
SeriesName = series.Title,
SeasonNumber = item.SeasonNumber,
EpisodeNumber = item.EpisodeNumber,
Title = item.Title,
Overview = item.Overview,
AirDate = item.AirDate.Add(Convert.ToDateTime(series.AirTimes).TimeOfDay)
});
}
2011-03-23 08:06:22 +01:00
return View(new GridModel(upcoming));
}
}
2011-04-10 04:44:01 +02:00
}