public ActionResult GetResults(SearchFieldsViewModel model, string gender, string name, int?page) { if (Request["Name"] != null && Request["Name"] != "") { name = Request["Name"]; ViewBag.Name = name; } if (Request["Gender"] != null && Request["Gender"] != "") { gender = Request["Gender"]; ViewBag.GenderList = gender; } List <Results> ancestryResults = new List <Results>(); try { ancestryResults = _ancestrySearch.Search(name, gender, ""); } catch (Exception ex) { _logger.Error("Unable to search ancestry database due to: " + ex.Message, ex); } if (ancestryResults.Count < 1) { ViewBag.NoResults = "true"; } int pageSize = 10; int pageNumber = (page ?? 1); return(PartialView("_ResultPartial", ancestryResults.ToPagedList(pageNumber, pageSize))); }
public IViewComponentResult Invoke(string actionMethod) { var vm = new SearchFieldsViewModel { ActionMethod = actionMethod }; return(View(vm)); }
public ActionResult GetResults(SearchFieldsViewModel model, string gender, string name, string direction) { if (Request["Name"] != null && Request["Name"] != "") { name = Request["Name"]; ViewBag.Name = name; } if (Request["Gender"] != null && Request["Gender"] != "") { gender = Request["Gender"]; } if (Request["direction"] != null && Request["direction"] != "") { direction = Request["direction"]; } IEnumerable <Results> ancestryResults = new List <Results>(); try { ancestryResults = _ancestrySearch.Search(name, gender, direction); } catch (Exception ex) { _logger.Error("Unable to search ancestry database due to: " + ex.Message, ex); } if (ancestryResults.Count() < 1) { ViewBag.NoResults = "true"; } return(PartialView("_ResultPartial", ancestryResults.Take(10))); }