public PageViewModel GetFeaturedCustomPage(int pageId) { PageViewModel model = new PageViewModel(); if (this.PageExists(pageId)) { Page dbPage = this.Data.Pages.Find(pageId); model.Id = dbPage.Id; model.Title = dbPage.Title; model.Summary = dbPage.Summary; } else { model.Id = 99999; model.Title = "Page Do Not Exists"; model.Summary = "There are no pages, please contact the system administrator"; } return model; }
public PageViewModel GetPageById(int id) { PageViewModel model = new PageViewModel(); if (this.PageExists(id)) { Page dbPage = this.Data.Pages.Find(id); model.Id = dbPage.Id; model.Title = dbPage.Title; model.Summary = dbPage.Summary; model.Content = dbPage.Content; } else { model.Id = 1; model.Title = "НЕСЪЩЕСТВУВАЩА СТРАНИЦА!"; model.Content = "НЕСЪЩЕСТВУВАЩА СТРАНИЦА!"; model.Summary = "НЕСЪЩЕСТВУВАЩА СТРАНИЦА!"; } return model; }
private PageViewModel MapPageViewModel(Page page) { PageViewModel model = new PageViewModel(); model.Id = page.Id; model.Title = page.Title; model.Summary = page.Summary; model.Content = page.Content; return model; }