using System.Linq; using System.Web.Mvc; using LeafWeb.Core.Utility; using LeafWeb.Web.Attributes; using LeafWeb.Web.ViewModels.Results; namespace LeafWeb.Web.Controllers { public class ResultsController : ControllerBase { public ActionResult Index() { var viewModel = DataService.GetLeafInputs() .OrderByDescending(f => f.Id) .ToList() .Select(leafInput => new ResultStatusViewModel(leafInput)); return View(viewModel); } [ActionLog] public FileContentResult DownloadResults(int id) { var leafInput = DataService.GetLeafInput(id); var zip = leafInput.GetOutputFileZip(); var filename = leafInput.Identifier.FilterValidFilename() + ".zip"; return new FileContentResult(zip, "application/zip") { FileDownloadName = filename }; } } }