public ActionResult Article(string articleAlias) { InformationPageDTO informationPageDTO = _informationService.GetArticlePage(articleAlias); if (informationPageDTO == null) { return(NotFound()); } IMapper mapper = new MapperConfiguration(cfg => cfg.CreateMap <InformationPageDTO, InformationPageViewModel>()).CreateMapper(); InformationPageViewModel model = mapper.Map <InformationPageViewModel>(informationPageDTO); if (_siteSettings.TryGetValue("BigBannerId", out string bannerIdString)) { if (int.TryParse(bannerIdString, out int singleBannerId)) { BannerDTO bannerDTO = _bannerService.GetBanner(singleBannerId); IMapper bannerMapper = new MapperConfiguration(cfg => { cfg.CreateMap <BannerDTO, BannerViewModel>(); cfg.CreateMap <ImageDTO, ImageViewModel>(); }).CreateMapper(); BannerViewModel banner = bannerMapper.Map <BannerViewModel>(bannerDTO); ViewBag.SingleBanner = banner; } } ViewBag.Title = model.Title; return(View(model)); }
public InformationPage() { InitializeComponent(); this.ViewModel = new InformationPageViewModel() { Title = this.Title }; this.BindingContext = this.ViewModel; }
public ViewResult Index(InformationPage currentPage) { var archivePage = _newService.GetInformationArchivePage(currentPage); var model = new InformationPageViewModel(currentPage) { LatestInformationPages = _newService.GetLatestInformationPages(archivePage, HttpContext), ArchivePage = archivePage, HeadlineForListLatestPages = _newService.GetTitleForLatestInformatonPages(archivePage), SeemoreText = _newService.GetSeemoreTextForLatestInformationPages(archivePage), }; return(View("Index", model)); }
public InformationPage2() { InitializeComponent(); BindingContext = new InformationPageViewModel(); }
public InformationPage(InformationPageViewModel viewModel) { InitializeComponent(); BindingContext = viewModel; }