Add search query
This commit is contained in:
@@ -3,22 +3,45 @@ using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Utility;
|
||||
using LeafWeb.WebCms.Models;
|
||||
using LeafWeb.WebCms.Utility;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace LeafWeb.WebCms.Controllers
|
||||
{
|
||||
public class ResultsController : BaseController
|
||||
{
|
||||
[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||
public ActionResult Search()
|
||||
{
|
||||
var viewModel =
|
||||
from li in DataService.GetLeafInputsOrdered()
|
||||
select li;
|
||||
return View(viewModel);
|
||||
}
|
||||
//[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||
public ActionResult Index(LeafDataQuery query)
|
||||
{
|
||||
var resultItems =
|
||||
DataService.GetLeafInputsOrdered();
|
||||
|
||||
public ActionResult Recent()
|
||||
resultItems = QueryFilter.Search(resultItems, query);
|
||||
|
||||
var searchViewModel = new SearchViewModel
|
||||
{
|
||||
Items = resultItems,
|
||||
Q = query
|
||||
};
|
||||
|
||||
return View(searchViewModel);
|
||||
}
|
||||
|
||||
|
||||
//[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||
[HttpPost]
|
||||
public ActionResult Search(LeafDataQuery query)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return CurrentUmbracoPage();
|
||||
}
|
||||
|
||||
return RedirectToCurrentUmbracoPage(query.GetNameValueCollection());
|
||||
}
|
||||
|
||||
public ActionResult Recent()
|
||||
{
|
||||
var dateThreshold = DateTime.Today.Subtract(TimeSpan.FromDays(90));
|
||||
var viewModel =
|
||||
|
||||
Reference in New Issue
Block a user