rename query to model in actions, fixing problems with binding
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Caching;
|
using System.Web.Caching;
|
||||||
@@ -20,13 +19,13 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
{
|
{
|
||||||
private const int TimeSamples = 40;
|
private const int TimeSamples = 40;
|
||||||
|
|
||||||
public ActionResult Index(LeafDataQuery query)
|
public ActionResult Index(LeafDataQuery model)
|
||||||
{
|
{
|
||||||
var resultItems =
|
var resultItems =
|
||||||
DataService.GetLeafInputsOrdered();
|
DataService.GetLeafInputsOrdered();
|
||||||
|
|
||||||
resultItems
|
resultItems
|
||||||
= QueryFilter.Search(resultItems, query, Members.GetCurrentLoginStatus()?.Email);
|
= QueryFilter.Search(resultItems, model, Members.GetCurrentLoginStatus()?.Email);
|
||||||
|
|
||||||
var timeInProgressEstimater = TimeInProgressEstimater();
|
var timeInProgressEstimater = TimeInProgressEstimater();
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
{
|
{
|
||||||
Items = resultItems,
|
Items = resultItems,
|
||||||
ServerDescription = serviceDescription,
|
ServerDescription = serviceDescription,
|
||||||
Q = query,
|
Q = model,
|
||||||
TimeInProgressEstimater = timeInProgressEstimater
|
TimeInProgressEstimater = timeInProgressEstimater
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,14 +44,14 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Search(LeafDataQuery query)
|
public ActionResult Search(LeafDataQuery model)
|
||||||
{
|
{
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
return CurrentUmbracoPage();
|
return CurrentUmbracoPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToCurrentUmbracoPage(query.GetNameValueCollection());
|
return RedirectToCurrentUmbracoPage(model.GetNameValueCollection());
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeInProgressEstimater TimeInProgressEstimater()
|
private TimeInProgressEstimater TimeInProgressEstimater()
|
||||||
|
|||||||
@@ -10,21 +10,21 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
public class ResultsController : BaseController
|
public class ResultsController : BaseController
|
||||||
{
|
{
|
||||||
[MemberAuthorize(AllowGroup = "Authenticated")]
|
[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||||
public ActionResult Index(LeafDataQuery query)
|
public ActionResult Index(LeafDataQuery model)
|
||||||
{
|
{
|
||||||
if (!query.HasParameters && !TempData.ContainsKey("Posted"))
|
if (!model.HasParameters && !TempData.ContainsKey("Posted"))
|
||||||
query.usr = true;
|
model.usr = true;
|
||||||
|
|
||||||
var resultItems =
|
var resultItems =
|
||||||
DataService.GetLeafInputsOrdered();
|
DataService.GetLeafInputsOrdered();
|
||||||
|
|
||||||
resultItems =
|
resultItems =
|
||||||
QueryFilter.Search(resultItems, query, Members.GetCurrentLoginStatus()?.Email);
|
QueryFilter.Search(resultItems, model, Members.GetCurrentLoginStatus()?.Email);
|
||||||
|
|
||||||
var searchViewModel = new SearchViewModel
|
var searchViewModel = new SearchViewModel
|
||||||
{
|
{
|
||||||
Items = resultItems,
|
Items = resultItems,
|
||||||
Q = query
|
Q = model
|
||||||
};
|
};
|
||||||
|
|
||||||
return View(searchViewModel);
|
return View(searchViewModel);
|
||||||
@@ -32,7 +32,7 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
|
|
||||||
[MemberAuthorize(AllowGroup = "Authenticated")]
|
[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Search(LeafDataQuery query)
|
public ActionResult Search(LeafDataQuery model)
|
||||||
{
|
{
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
|
|
||||||
TempData["Posted"] = true;
|
TempData["Posted"] = true;
|
||||||
|
|
||||||
return RedirectToCurrentUmbracoPage(query.GetNameValueCollection());
|
return RedirectToCurrentUmbracoPage(model.GetNameValueCollection());
|
||||||
}
|
}
|
||||||
|
|
||||||
[MemberAuthorize(AllowGroup = "Authenticated")]
|
[MemberAuthorize(AllowGroup = "Authenticated")]
|
||||||
|
|||||||
Reference in New Issue
Block a user