Esempio n. 1
0
        public JsonResult SetFilter(string key, string value)
        {
            SearchProvider sp = GetSearchProvider();

            if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
            {
                sp.UpateSearchCriterias(key, value);
            }
            else
            {
                sp.DeleteSearchCriterias(key);
            }

            return(Json(true));
        }
Esempio n. 2
0
        public ActionResult Search(string searchValue)
        {
            SearchProvider sp = GetSearchProvider();

            if (searchValue == null)
            {
                sp.DeleteSearchCriterias(SearchProvider.FREETEXT_SEARCH_KEY);
            }
            else
            {
                sp.UpateSearchCriterias(SearchProvider.FREETEXT_SEARCH_KEY, searchValue);
            }

            Debug.WriteLine("SEARCH : " + searchValue);

            List <NodeModel> Model          = new List <NodeModel>();
            SubjectManager   subjectManager = new SubjectManager();

            //Get filtered subjects
            //var species = sp.Search();

            SearchManager searchManager = new SearchManager();

            var species = searchManager.Search(sp.SearchCriterias);

            if (species != null)
            {
                //convert all subjects to subjectModels
                species = species.OrderBy(p => p.Name);
                species.ToList().ForEach(s => Model.Add(NodeModel.Convert(s)));
            }

            //update searchcriterias

            return(PartialView("_searchResult", Model));
        }