public ActionResult WorldCheckSearchMatches_Kendo2(string searchTerm, string keywords, string country, string category) { WorldCheckSearchCriteriaDto criteria = new WorldCheckSearchCriteriaDto(); if (!string.IsNullOrEmpty(searchTerm)) { criteria.Name = searchTerm; } if (!string.IsNullOrEmpty(keywords)) { criteria.Keywords = keywords; } if (!string.IsNullOrEmpty(country)) { criteria.Country = country; } if (!string.IsNullOrEmpty(category)) { criteria.Category = category; } var matches = _bm.GetWorldCheckMatches(criteria); return(new JsonNetResult { Data = new { total = matches.Count, results = matches } }); }
public List <WorldCheckService.SearchResult> GetWorldCheckMatches(WorldCheckSearchCriteriaDto criteria) { return(_rep.GetWorldCheckMatches(string.IsNullOrEmpty(criteria.Name) ? null: criteria.Name, string.IsNullOrEmpty(criteria.Keywords) ? null : criteria.Keywords, string.IsNullOrEmpty(criteria.Country) ? null : criteria.Country, string.IsNullOrEmpty(criteria.Category) ? null : criteria.Category, HttpContext.Current.User.Identity.Name.ToString( CultureInfo.InvariantCulture))); }
public ActionResult _WorldCheckSearchFormData() { var _categories = _bm.GetCategories(); var _countries = _bm.GetCountries(); var categories = new List <string>(); var countries = new List <string>(); // add the all/blank categories.Add(string.Empty); countries.Add(string.Empty); countries.AddRange(_countries.Select(item => item.Name)); categories.AddRange(_categories.Select(item => item.Name)); var searchCriteria = new WorldCheckSearchCriteriaDto(); return(new JsonNetResult { Data = new { Countries = countries, Categories = categories, Criteria = searchCriteria } }); }
public ActionResult _Search(WorldCheckSearchCriteriaDto criteria) { try { if ((string.IsNullOrEmpty(criteria.Name)) && (string.IsNullOrEmpty(criteria.Keywords)) && (string.IsNullOrEmpty(criteria.Country)) && (string.IsNullOrEmpty(criteria.Category))) { return(PartialView(new List <SearchResult>())); } List <SearchResult> matches = _bm.GetWorldCheckMatches(criteria); Response.StatusCode = (Int32)HttpStatusCode.Created; return(PartialView(matches)); } catch (Exception ex) { _logHandler.WriteLog(ex.ToString(), LogSeverity.Error, LogCategory.Controller); throw new HttpException(500, "Server Error", ex); } }
public ActionResult _WorldCheckSearchForm() { var searchCriteria = new WorldCheckSearchCriteriaDto(); return(PartialView(searchCriteria)); }