/// <summary> /// Assigns the search result. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="projectList">The project list.</param> /// <param name="developerList">The developer list.</param> /// <param name="taskList">The task list.</param> private static void AssignSearchResult(GlobalSearchPresenter presenter, IList<ProjectListItem> projectList, IList<DeveloperListItem> developerList, IList<TaskResult> taskList) { IList<SearchResultItem> searchResultToDisplay = new List<SearchResultItem>(); var filteredProjectsList = MapProjectToSearchResults(projectList); var filteredDevelopersList = MapDeveloperToSearchResult(developerList); var filteredTaskList = MapTaskToSearchResults(taskList); var searchResult = filteredProjectsList.Concat(filteredDevelopersList).Concat(filteredTaskList).ToList(); presenter.AssignAllSearchRecordList(searchResult); searchResultToDisplay = searchResult.Take(InitialNumberOfRecords).ToList<SearchResultItem>(); presenter.AssignSearchResultList(searchResultToDisplay); presenter.RecordCount = presenter.AllSearchRecordList.Count < InitialNumberOfRecords ? presenter.AllSearchRecordList.Count : InitialNumberOfRecords; }
/// <summary> /// Function to get more search records. /// </summary> /// <param name="presenter">The presenter</param> /// <param name="numberOfRecords">The number of records.</param> /// <param name="searchText">The search text.</param> /// <returns> /// The partial view /// </returns> public ActionResult ShowMoreRecords(GlobalSearchPresenter presenter, int numberOfRecords, string searchText) { if (presenter != null) { IList<SearchResultItem> searchResult = new List<SearchResultItem>(); if (SessionData.Instance.GlobalSearchItems != null) { IList<SearchResultItem> searchRecordList = new List<SearchResultItem>(); searchRecordList = SessionData.Instance.GlobalSearchItems; presenter.AssignAllSearchRecordList(searchRecordList); int totalCount = presenter.RecordCount + numberOfRecords; presenter.RecordCount = totalCount < searchRecordList.Count ? totalCount : searchRecordList.Count; searchResult = searchRecordList.Take(presenter.RecordCount).ToList<SearchResultItem>(); presenter.AssignSearchResultList(searchResult); } } return this.PartialView(SearchRecordsPartialView, presenter); }