1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-27 18:28:19 +00:00
Sonarr/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 07:06:22 +00: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 02:44:01 +00:00
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
private readonly SeriesProvider _seriesProvider;
2011-03-23 07:06:22 +00:00
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider, SeriesProvider seriesProvider)
2011-03-23 07:06:22 +00:00
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
_seriesProvider = seriesProvider;
2011-03-23 07:06:22 +00: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 02:44:01 +00:00
2011-03-23 07:06:22 +00: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 07:06:22 +00: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 07:06:22 +00: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 07:06:22 +00:00
return View(new GridModel(upcoming));
}
}
2011-04-10 02:44:01 +00:00
}