1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Web/Controllers/UpcomingController.cs

100 lines
3.2 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
2011-03-23 09:06:22 +02: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 05:44:01 +03:00
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
2011-03-23 09:06:22 +02:00
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider)
2011-03-23 09:06:22 +02:00
{
_upcomingEpisodesProvider = upcomingEpisodesProvider;
}
//
// GET: /Upcoming/
public ActionResult Index()
{
return View();
}
[GridAction]
public ActionResult _AjaxBindingYesterday()
{
var upcoming = _upcomingEpisodesProvider.Yesterday().Select(u => new UpcomingEpisodeModel
{
SeriesId = u.Series.SeriesId,
EpisodeId = u.EpisodeId,
SeriesName = u.Series.Title,
SeasonNumber = u.SeasonNumber,
EpisodeNumber = u.EpisodeNumber,
Title = u.Title,
Overview = u.Overview,
2011-06-23 09:56:17 +03:00
AirDate = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
});
2011-04-10 05:44:01 +03:00
2011-03-23 09:06:22 +02:00
return View(new GridModel(upcoming));
}
[GridAction]
public ActionResult _AjaxBindingToday()
{
var upcoming = _upcomingEpisodesProvider.Today().Select(u => new UpcomingEpisodeModel
{
SeriesId = u.Series.SeriesId,
EpisodeId = u.EpisodeId,
SeriesName = u.Series.Title,
SeasonNumber = u.SeasonNumber,
EpisodeNumber = u.EpisodeNumber,
Title = u.Title,
Overview = u.Overview,
2011-06-23 09:56:17 +03:00
AirDate = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
});
2011-03-23 09:06:22 +02:00
return View(new GridModel(upcoming));
}
[GridAction]
public ActionResult _AjaxBindingTomorrow()
{
var upcoming = _upcomingEpisodesProvider.Tomorrow().Select(u => new UpcomingEpisodeModel
{
SeriesId = u.Series.SeriesId,
EpisodeId = u.EpisodeId,
SeriesName = u.Series.Title,
SeasonNumber = u.SeasonNumber,
EpisodeNumber = u.EpisodeNumber,
Title = u.Title,
Overview = u.Overview,
2011-06-23 09:56:17 +03:00
AirDate = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
});
return View(new GridModel(upcoming));
}
2011-03-23 09:06:22 +02:00
[GridAction]
public ActionResult _AjaxBindingWeek()
{
var upcoming = _upcomingEpisodesProvider.Week().Select(u => new UpcomingEpisodeModel
{
SeriesId = u.Series.SeriesId,
EpisodeId = u.EpisodeId,
SeriesName = u.Series.Title,
SeasonNumber = u.SeasonNumber,
EpisodeNumber = u.EpisodeNumber,
Title = u.Title,
Overview = u.Overview,
2011-06-23 09:56:17 +03:00
AirDate = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay)
});
2011-03-23 09:06:22 +02:00
return View(new GridModel(upcoming));
}
}
2011-04-10 05:44:01 +03:00
}