예제 #1
0
        public JsonResult Search(SearchRequest query)
        {
            var elements = new List<IFirmDataElement>();
            if (string.IsNullOrWhiteSpace(query.q))
            {
                elements.Add(new PlaceholderFirmDataElement("No search query. Please enter a search query."));
                return Json(elements);
            }

            elements.AddRange(ElementProvider.Singleton.AllElements.Where(q => (q.Title.Contains(query.q) || q.Description.Contains(query.q))));

            var queryResults = elements.ToList();
            //Thread.Sleep(1500); -- to simulate data access
            if (!queryResults.Any())
            {
                elements.Clear();
                elements.Add(new PlaceholderFirmDataElement("No matching items found"));
                return Json(elements);
            }

            return Json(queryResults);
        }
예제 #2
0
 public JsonResult Search(SearchRequest query)
 {
 }