You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone.Web/Controllers/HistoryController.cs

67 lines
2.3 KiB

using System;
using System.Collections.Generic;
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
{
private readonly HistoryProvider _historyProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly SeriesProvider _seriesProvider;
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider,
SeriesProvider seriesProvider)
{
_historyProvider = historyProvider;
_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 history = _historyProvider.AllItemsWithRelationships().Select(h => new HistoryModel
{
HistoryId = h.HistoryId,
SeasonNumber = h.Episode.SeasonNumber,
EpisodeNumber = h.Episode.EpisodeNumber,
EpisodeTitle = h.Episode.Title,
EpisodeOverview = h.Episode.Overview,
SeriesTitle = h.SeriesTitle,
NzbTitle = h.NzbTitle,
Quality = h.Quality.ToString(),
IsProper = h.IsProper,
Date = h.Date,
Indexer = h.Indexer
});
return View(new GridModel(history));
}
}
}