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

77 lines
2.6 KiB
C#
Raw Normal View History

2011-04-28 08:04:57 +02:00
using System;
using System.Collections.Generic;
2011-04-28 08:04:57 +02:00
using System.Linq;
using System.Web.Mvc;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
using Telerik.Web.Mvc;
namespace NzbDrone.Web.Controllers
{
public class HistoryController : Controller
{
2011-04-10 04:44:01 +02:00
private readonly HistoryProvider _historyProvider;
2011-06-17 08:59:13 +02:00
private readonly EpisodeProvider _episodeProvider;
private readonly SeriesProvider _seriesProvider;
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider,
SeriesProvider seriesProvider)
{
_historyProvider = historyProvider;
2011-06-17 08:59:13 +02:00
_episodeProvider = episodeProvider;
_seriesProvider = seriesProvider;
}
//
// GET: /History/
public ActionResult Index()
{
return View();
}
public ActionResult Trim()
{
_historyProvider.Trim();
return RedirectToAction("Index");
}
public ActionResult Purge()
{
_historyProvider.Purge();
return RedirectToAction("Index");
}
[GridAction]
public ActionResult _AjaxBinding()
{
var historyDb = _historyProvider.AllItems();
var history = new List<HistoryModel>();
2011-06-17 08:59:13 +02:00
foreach (var item in historyDb)
{
2011-06-17 08:59:13 +02:00
var episode = _episodeProvider.GetEpisode(item.EpisodeId);
var series = _seriesProvider.GetSeries(item.SeriesId);
2011-06-17 08:59:13 +02:00
history.Add(new HistoryModel
{
HistoryId = item.HistoryId,
SeasonNumber = episode.SeasonNumber,
EpisodeNumber = episode.EpisodeNumber,
EpisodeTitle = episode.Title,
EpisodeOverview = episode.Overview,
SeriesTitle = series.Title,
NzbTitle = item.NzbTitle,
Quality = item.Quality.ToString(),
IsProper = item.IsProper,
Date = item.Date,
Indexer = item.Indexer
});
}
return View(new GridModel(history));
}
}
2011-04-10 04:44:01 +02:00
}