private static void PrintResult(IEnumerable <SearchContent> searchPieces, SearchContentType contentType, string title, string nothingFoundMessage) { var resources = searchPieces.Where(_ => contentType.HasFlag(_.ContentType)); if (resources.Any()) { Console.WriteLine(title); foreach (var missing in resources.OrderBy(_ => _.Raw)) { Console.WriteLine("\t" + missing.Raw); } } else { Console.WriteLine(nothingFoundMessage); } }
/// <summary> /// The map from. /// </summary> /// <param name="searchResults"> /// The input. /// </param> /// <param name="searchContentType"> /// The search Content Type. /// </param> /// <param name="searchForm"> /// The search Form. /// </param> /// <returns> /// The blog search page view model. /// </returns> public SearchPageViewModel MapFrom( IEnumerable<AddressableContentBase> searchResults, SearchContentType searchContentType, SearchFormViewModel searchForm) { var pageViewModel = new SearchPageViewModel { Results = searchResults.ToList().MapAllUsing(this.searchResultViewModelMapper), ContentTypes = this.searchContentTypeSelectListMapper.MapFrom(searchContentType), Form = searchForm }; if (searchForm.DateFrom.HasValue) { pageViewModel.DateFrom = searchForm.DateFrom.Value.ToString("dd MMMM yyyy"); } if (searchForm.DateTo.HasValue) { pageViewModel.DateTo = searchForm.DateTo.Value.ToString("dd MMMM yyyy"); } return pageViewModel; }
/// <summary> /// The map from. /// </summary> /// <param name="contentType"> /// The content type. /// </param> /// <returns> /// The mapped select list. /// </returns> public SelectList MapFrom(SearchContentType contentType) { return new SelectList(contentType.ToList(), contentType); }
public SearchContent(string raw, SearchContentType contentType) { Raw = raw; ContentType = contentType; }
private static void PrintResult(IEnumerable<SearchContent> searchPieces, SearchContentType contentType, string title, string nothingFoundMessage) { var resources = searchPieces.Where(_ => contentType.HasFlag(_.ContentType)); if (resources.Any()) { Console.WriteLine(title); foreach (var missing in resources.OrderBy(_ => _.Raw)) { Console.WriteLine("\t" + missing.Raw); } } else { Console.WriteLine(nothingFoundMessage); } }