Search now works more than once
Browser validation for search
This commit is contained in:
@@ -20,14 +20,16 @@ namespace LeafWeb.WebCms.Controllers
|
||||
private const int TimeSamples = 40;
|
||||
|
||||
public ActionResult Index(LeafDataQuery query)
|
||||
{
|
||||
{
|
||||
//query.lat = 32;
|
||||
|
||||
var resultItems =
|
||||
DataService.GetLeafInputsOrdered();
|
||||
|
||||
// search functionality
|
||||
if (!string.IsNullOrEmpty(query.Query))
|
||||
if (!string.IsNullOrEmpty(query.q))
|
||||
{
|
||||
foreach (var piece in query.Query.Split(' ').Select(p => p.Trim()))
|
||||
foreach (var piece in query.q.Split(' ').Select(p => p.Trim()))
|
||||
{
|
||||
resultItems =
|
||||
from li in resultItems
|
||||
@@ -46,17 +48,28 @@ namespace LeafWeb.WebCms.Controllers
|
||||
{
|
||||
Items = resultItems,
|
||||
ServerDescription = serviceDescription,
|
||||
Query = new LeafDataQuery
|
||||
{
|
||||
Query = query.Query
|
||||
},
|
||||
Q = query,
|
||||
TimeInProgressEstimater = timeInProgressEstimater
|
||||
};
|
||||
|
||||
return View(queueViewModel);
|
||||
}
|
||||
|
||||
private TimeInProgressEstimater TimeInProgressEstimater()
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Search(LeafDataQuery q)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return CurrentUmbracoPage();
|
||||
}
|
||||
//if (q == null)
|
||||
// return CurrentUmbracoPage();
|
||||
//var collection = q.GetNameValueCollection();
|
||||
return RedirectToCurrentUmbracoPage(q.GetNameValueCollection());
|
||||
}
|
||||
|
||||
private TimeInProgressEstimater TimeInProgressEstimater()
|
||||
{
|
||||
|
||||
// TODO: move this to a background process
|
||||
@@ -80,12 +93,6 @@ namespace LeafWeb.WebCms.Controllers
|
||||
return Content(string.Join("<br />", data));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Search(LeafDataQuery query)
|
||||
{
|
||||
var collection = new NameValueCollection() {{"Query.Query", query.Query}};
|
||||
return RedirectToCurrentUmbracoPage(collection);
|
||||
}
|
||||
|
||||
private static string ServiceDescription()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user