public PartialViewResult Navbar(String category = null, String searchText = null) { List <Category> categories = articleRepository.GetAllCategories(); List <Article> articles = articleRepository.GetAllArticles(); MenuCategoriesListViewModel model = new MenuCategoriesListViewModel(category, searchText) { Categories = Mapper.Map <List <Category>, List <MenuCategoryModel> >(categories), }; ArticleService.CalculateCategoriesCount(model.Categories, articles); return(PartialView("NavbarPartial", model)); }
public ViewResult All(int page = 1, String category = null, String searchText = null) { ArticlesSummariesViewModel model = new ArticlesSummariesViewModel(category, searchText); List <Article> articles = articleRepository.GetAllArticles(category: category, searchText: searchText); model.PaginationModel = PaginationService.GetDefaultPaginationModel(articles, page); articles = PaginationService.Paginate(articles, page).ToList(); model.Articles = articles; return(View(model)); }
public ActionResult ShowAllArticles() { var articles = _articlesRepository.GetAllArticles(); var map = AutoMapper.Mapper.CreateMap <IArticle, Article>(); var articleModels = articles.Select(AutoMapper.Mapper.Map <Article>); var model = new ArticlesModel { Articles = articleModels }; return(View("~/Views/Partials/ArticlesListingView.cshtml", model)); }
public ArticlesModel Index() { var articles = _articlesRepository.GetAllArticles(); var map = AutoMapper.Mapper.CreateMap <IArticle, Article>(); var articleModels = articles.Select(AutoMapper.Mapper.Map <Article>); var model = new ArticlesModel { Articles = articleModels }; return(model); }
// GET: Articles public ActionResult Index() { var articles = _articlesRepository.GetAllArticles(); return(View(articles)); }