Limit results

This commit is contained in:
2017-01-23 10:42:49 -05:00
parent 87462a674f
commit 295b40bed8
4 changed files with 11 additions and 12 deletions
+8 -3
View File
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Web.Mvc;
using LeafWeb.Core.Entities;
@@ -10,10 +11,14 @@ namespace LeafWeb.WebCms.Controllers
{
public ActionResult Index()
{
var dateThreshold = DateTime.Today.Subtract(TimeSpan.FromDays(90));
var viewModel =
DataService.GetLeafInputs()
.OrderByDescending(f => f.Id)
.ToList()
(
from li in DataService.GetLeafInputs()
where li.Added >= dateThreshold
orderby li.Id descending
select li
).ToList()
.Select(leafInput => new ResultItemViewModel(leafInput));
return View(viewModel);
}