public static StandardPageViewModel Create(StandardPage currentPage, CategoryRepository categoryRepository) { var model = new StandardPageViewModel(currentPage); if (currentPage.Category.Any()) { model.CategoryName = categoryRepository.Get(currentPage.Category.FirstOrDefault()).Description; } return(model); }
public ActionResult Index(StandardPage currentPage) { var model = StandardPageViewModel.Create(currentPage, _categoryRepository); return(View(model)); }