41 lines
1016 B
C#
41 lines
1016 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using LeafWeb.Core.Entities;
|
|
using LeafWeb.Core.Utility;
|
|
using LeafWeb.WebCms.Models;
|
|
|
|
namespace LeafWeb.WebCms.Controllers
|
|
{
|
|
public class ResultsController : BaseController
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
var dateThreshold = DateTime.Today.Subtract(TimeSpan.FromDays(90));
|
|
var viewModel =
|
|
(
|
|
from li in DataService.GetLeafInputs()
|
|
where li.Added >= dateThreshold
|
|
orderby li.Id descending
|
|
select li
|
|
).ToList()
|
|
.Select(leafInput => new QueueItemViewModel(leafInput));
|
|
return View(viewModel);
|
|
}
|
|
|
|
[ActionLog]
|
|
public ActionResult Download(string token)
|
|
{
|
|
var leafInput = DataService.GetLeafInput(token);
|
|
|
|
if (leafInput == null)
|
|
return View("DownloadNotFound");
|
|
|
|
var zip = leafInput.GetOutputFileZip(LeafOutputFileType.ToUser);
|
|
|
|
var filename = leafInput.Identifier.FilterValidFilename() + ".zip";
|
|
|
|
return new FileContentResult(zip, "application/zip") { FileDownloadName = filename };
|
|
}
|
|
}
|
|
} |