2011-04-28 08:04:57 +02:00
|
|
|
|
using System;
|
2011-06-14 17:07:48 +02:00
|
|
|
|
using System.Collections.Generic;
|
2011-04-28 08:04:57 +02:00
|
|
|
|
using System.Linq;
|
2011-03-23 06:19:23 +01:00
|
|
|
|
using System.Web.Mvc;
|
2011-04-28 06:27:02 +02:00
|
|
|
|
using NzbDrone.Core.Model;
|
2011-03-23 06:19:23 +01:00
|
|
|
|
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;
|
2011-06-18 05:11:04 +02:00
|
|
|
|
private readonly SeriesProvider _seriesProvider;
|
2011-03-23 06:19:23 +01:00
|
|
|
|
|
2011-06-18 05:11:04 +02:00
|
|
|
|
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider,
|
|
|
|
|
SeriesProvider seriesProvider)
|
2011-03-23 06:19:23 +01:00
|
|
|
|
{
|
|
|
|
|
_historyProvider = historyProvider;
|
2011-06-17 08:59:13 +02:00
|
|
|
|
_episodeProvider = episodeProvider;
|
2011-06-18 05:11:04 +02:00
|
|
|
|
_seriesProvider = seriesProvider;
|
2011-03-23 06:19:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// 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()
|
|
|
|
|
{
|
2011-06-20 01:44:45 +02:00
|
|
|
|
var history = _historyProvider.AllItemsWithRelationships().Select(h => new HistoryModel
|
2011-06-14 17:07:48 +02:00
|
|
|
|
{
|
2011-06-20 01:44:45 +02:00
|
|
|
|
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
|
2011-06-14 17:07:48 +02:00
|
|
|
|
});
|
2011-03-23 06:19:23 +01:00
|
|
|
|
|
|
|
|
|
return View(new GridModel(history));
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-04-10 04:44:01 +02:00
|
|
|
|
}
|