1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-24 08:44:46 +00:00
Sonarr/NzbDrone.Web/Controllers/HistoryController.cs
kay.one 6f73260ab7 Merge branch 'markus101'
Conflicts:
	NzbDrone.Web/NzbDrone.Web.csproj
	NzbDrone.Web/Views/Log/Index.cshtml
2011-04-21 21:03:59 -07:00

63 lines
No EOL
2.3 KiB
C#

using System.Linq;
using System.Web.Mvc;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
using Telerik.Web.Mvc;
namespace NzbDrone.Web.Controllers
{
public class HistoryController : Controller
{
private readonly HistoryProvider _historyProvider;
public HistoryController(HistoryProvider historyProvider)
{
_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()
{
//TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called
var history = _historyProvider.AllItems().ToList().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.Episode.Series.Title,
NzbTitle = h.NzbTitle,
Quality = h.Quality.ToString(),
IsProper = h.IsProper,
Date = h.Date
});
history.ToList();
return View(new GridModel(history));
}
}
}