public ActionResult Results(Playground.BusinessLogic.EmployeeSearchCriteria searchCriteria) { if (searchCriteria.Validate()) { //searchCriteria.PageNumber = searchCriteria.PageNumber ?? 1; //searchCriteria.RecordsPerPage = searchCriteria.RecordsPerPage ?? 20; var model = new Playground.Models.EmployeeSearchResultsModel(); var search = new Playground.BusinessLogic.EmployeeSearch(); model.SearchResults = search.Search(searchCriteria); model.Criteria = searchCriteria; return View(model); } else { return RedirectToAction("Index"); } }
// // GET: /EmployeeSearchApi/ public ActionResult Index(Playground.BusinessLogic.EmployeeSearchCriteria searchCriteria) { var json = new JsonResult(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; if (!searchCriteria.Validate()) { json.Data = searchCriteria.ValidationErrors; } else { var search = new Playground.BusinessLogic.EmployeeSearch(); var results = search.Search(searchCriteria); json.Data = results; } return json; }