//protected override void OnLoad(EventArgs e) //{ // base.OnLoad(e); // processData(); //} #endregion #region Private Methods private void processData() { try { if (this.BlogSearchList != null) { // Validate(); string siteName = SiteName; // Call the datamanger to perform the search ICollection <SeriesPrevNextResult> searchResults = BlogSearchDataManager.Execute(this.BlogSearchList.Filter, this.BlogSearchList.ContentID, this.BlogSearchList.Language, Settings.IsLive, siteName); BlogSearchResult blogSearch = new BlogSearchResult(); blogSearch.Results = searchResults; blogSearch.SiteName = siteName; LiteralControl ltl = new LiteralControl(VelocityTemplate.MergeTemplateWithResults(this.BlogSearchList.ResultsTemplate, blogSearch)); Controls.Add(ltl); } } catch (Exception ex) { log.Error("this.SearchListSnippet:processData", ex); } }
public IActionResult SearchWith(string keyword) { var resultsList = new List <SearchResult>(); if (keyword is null || keyword == "") { return(Json(resultsList)); } var blogResults = searchService.BlogsWithKeyword(keyword).Take(3); foreach (var blg in blogResults) { var owner = blogService.Owner(blg.Id); var newResult = new BlogSearchResult(keyword, blg, owner); resultsList.Add(newResult); } var userResults = searchService.UsersWithKeyword(keyword).Take(3); foreach (var usr in userResults) { var blogs = userBlogService.GetBlogsForUser(usr.Id); resultsList.Add(new UserSearchResult(keyword, new UserNoPass(usr), blogs)); } var sectionResults = searchService.SectionsWithKeyword(keyword).Take(3); foreach (var sect in sectionResults) { var blogs = sectionsService.BlogsUsingSectId(sect.Id); resultsList.Add(new SectionSearchResult(keyword, sect, blogs)); } return(Json(resultsList)); }