2011-04-10 04:44:01 +02:00
|
|
|
|
using System.Linq;
|
2011-03-23 06:19:23 +01:00
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
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-03-23 06:19:23 +01:00
|
|
|
|
|
2011-04-09 01:58:46 +02:00
|
|
|
|
public HistoryController(HistoryProvider historyProvider)
|
2011-03-23 06:19:23 +01:00
|
|
|
|
{
|
|
|
|
|
_historyProvider = historyProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// 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-04-22 06:03:59 +02:00
|
|
|
|
|
|
|
|
|
//TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called
|
2011-04-22 07:46:47 +02:00
|
|
|
|
//https://github.com/subsonic/SubSonic-3.0/issues/263
|
2011-04-22 06:03:59 +02:00
|
|
|
|
|
|
|
|
|
var history = _historyProvider.AllItems().ToList().Select(h => new HistoryModel
|
2011-03-23 06:19:23 +01:00
|
|
|
|
{
|
|
|
|
|
HistoryId = h.HistoryId,
|
|
|
|
|
SeasonNumber = h.Episode.SeasonNumber,
|
|
|
|
|
EpisodeNumber = h.Episode.EpisodeNumber,
|
|
|
|
|
EpisodeTitle = h.Episode.Title,
|
|
|
|
|
EpisodeOverview = h.Episode.Overview,
|
|
|
|
|
SeriesTitle = h.Episode.Series.Title,
|
|
|
|
|
NzbTitle = h.NzbTitle,
|
2011-04-22 06:03:59 +02:00
|
|
|
|
Quality = h.Quality.ToString(),
|
2011-03-23 06:19:23 +01:00
|
|
|
|
IsProper = h.IsProper,
|
|
|
|
|
Date = h.Date
|
|
|
|
|
});
|
|
|
|
|
|
2011-04-22 06:03:59 +02:00
|
|
|
|
history.ToList();
|
|
|
|
|
|
2011-03-23 06:19:23 +01:00
|
|
|
|
return View(new GridModel(history));
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-04-10 04:44:01 +02:00
|
|
|
|
}
|