Пример #1
0
 /// <summary>
 ///Maps data to an empty view model for a 404 page.
 /// </summary>
 /// <param name="viewModel">The view model to map data to.</param>
 /// <param name="mappingParameters">The data passed through to map to the view model.</param>
 public virtual void MapNotFoundPageViewModel(
     INotFoundPageViewModel viewModel,
     NotFoundPageViewModelBuilderParameters mappingParameters
     )
 {
     viewModel.PageTitle       = "Page not found";
     viewModel.MetaDescription = "Sorry, that page could not be found";
 }
Пример #2
0
        /// <summary>
        /// Maps data to an empty view model for a 404 page.
        /// </summary>
        /// <param name="viewModel">The view model to map data to.</param>
        /// <param name="mappingParameters">The data passed through to map to the view model.</param>
        public virtual Task MapNotFoundPageViewModelAsync(
            INotFoundPageViewModel viewModel,
            NotFoundPageViewModelBuilderParameters mappingParameters
            )
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }
            if (mappingParameters == null)
            {
                throw new ArgumentNullException(nameof(mappingParameters));
            }

            viewModel.PageTitle             = "Not found";
            viewModel.MetaDescription       = "Sorry, that page could not be found";
            viewModel.Path                  = mappingParameters.Path;
            viewModel.PathBase              = mappingParameters.PathBase;
            viewModel.QueryString           = mappingParameters.QueryString;
            viewModel.StatusCode            = 404;
            viewModel.StatusCodeDescription = "Not Found";

            return(Task.CompletedTask);
        }