mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-27 02:07:41 +00:00
132 lines
No EOL
4.6 KiB
C#
132 lines
No EOL
4.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using NzbDrone.Core.Providers;
|
|
using NzbDrone.Web.Models;
|
|
using Telerik.Web.Mvc;
|
|
|
|
namespace NzbDrone.Web.Controllers
|
|
{
|
|
public class UpcomingController : Controller
|
|
{
|
|
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
|
|
|
|
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider)
|
|
{
|
|
_upcomingEpisodesProvider = upcomingEpisodesProvider;
|
|
}
|
|
|
|
//
|
|
// 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 = item.Series;
|
|
|
|
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));
|
|
}
|
|
|
|
[GridAction]
|
|
public ActionResult _AjaxBindingToday()
|
|
{
|
|
var upcomingDb = _upcomingEpisodesProvider.Today();
|
|
var upcoming = new List<UpcomingEpisodeModel>();
|
|
|
|
foreach (var item in upcomingDb)
|
|
{
|
|
var series = item.Series;
|
|
|
|
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));
|
|
}
|
|
|
|
[GridAction]
|
|
public ActionResult _AjaxBindingTomorrow()
|
|
{
|
|
var upcomingDb = _upcomingEpisodesProvider.Tomorrow();
|
|
var upcoming = new List<UpcomingEpisodeModel>();
|
|
|
|
foreach (var item in upcomingDb)
|
|
{
|
|
var series = item.Series;
|
|
|
|
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));
|
|
}
|
|
|
|
[GridAction]
|
|
public ActionResult _AjaxBindingWeek()
|
|
{
|
|
var upcomingDb = _upcomingEpisodesProvider.Week();
|
|
var upcoming = new List<UpcomingEpisodeModel>();
|
|
|
|
foreach (var item in upcomingDb)
|
|
{
|
|
var series = item.Series;
|
|
|
|
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));
|
|
}
|
|
}
|
|
} |