1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Web/Controllers/HistoryController.cs

62 lines
2.1 KiB
C#
Raw Normal View History

2011-04-28 09:04:57 +03:00
using System;
using System.Collections.Generic;
2011-04-28 09:04:57 +03: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 05:44:01 +03:00
private readonly HistoryProvider _historyProvider;
public HistoryController(HistoryProvider historyProvider)
{
_historyProvider = historyProvider;
}
//
// GET: /History/
public ActionResult Index()
{
return View();
}
public JsonResult Trim()
{
_historyProvider.Trim();
2011-08-22 04:00:12 +03:00
return Json(new NotificationResult() { Title = "Trimmed History items"});
}
public JsonResult Purge()
{
_historyProvider.Purge();
2011-08-22 04:00:12 +03:00
return Json(new NotificationResult() { Title = "History Cleared" });
}
[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));
}
}
2011-04-10 05:44:01 +03:00
}