コード例 #1
0
ファイル: Program.cs プロジェクト: rmaclean/UXLR
        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);
            }
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 public SearchContent(string raw, SearchContentType contentType)
 {
     Raw         = raw;
     ContentType = contentType;
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: rmaclean/UXLR
 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);
     }
 }
コード例 #6
0
ファイル: SearchContent.cs プロジェクト: rmaclean/UXLR
 public SearchContent(string raw, SearchContentType contentType)
 {
     Raw = raw;
     ContentType = contentType;
 }