/// <summary> /// Prepares the person search result. /// </summary> /// <param name="searchFor">The search for.</param> /// <param name="isAll">The is all.</param> /// <param name="searchPresenter">The search presenter.</param> /// <param name="searchFilter">The search filter.</param> /// <returns>The Task.</returns> private async Task PreparePersonSearchResult(string searchFor, bool? isAll, GlobalSearchPresenter searchPresenter, SearchFilters searchFilter) { var personSearchResult = await this.personManager.GetPersonsAsync(searchFilter, searchPresenter.AuthenticationToken); searchPresenter.GuestTotalResults = personSearchResult.GuestTotalResults; searchPresenter.CrewTotalResults = personSearchResult.CrewTotalResults; searchPresenter.VisitorTotalResults = personSearchResult.VisitorTotalResults; SessionData.Instance.PersonItemListResult.Clear(); SessionData.Instance.AssignPersonSearchResult(personSearchResult.Items.ToList()); searchPresenter.IsAll = isAll; if (!string.IsNullOrEmpty(searchFor)) { if (!searchFor.Equals(AllConstant, StringComparison.OrdinalIgnoreCase)) { searchPresenter.SelectedPersonType = searchFor; searchPresenter.SelectedOptionType = searchFor; } else if (string.IsNullOrEmpty(searchPresenter.SelectedPersonType) && searchFor.Equals(AllConstant, StringComparison.OrdinalIgnoreCase)) { searchPresenter.SelectedOptionType = searchPresenter.GuestTotalResults > 0 ? GuestConstant : searchPresenter.CrewTotalResults > 0 ? CrewConstant : searchPresenter.VisitorTotalResults > 0 ? VisitorConstant : string.Empty; } } if (personSearchResult.Items.Count > 0) { searchPresenter.AssignPersonSearchResult(personSearchResult); } }