Ejemplo n.º 1
0
        public IActionResult Articles(int page)
        {
            ArticlesViewModel avm = new ArticlesViewModel();
            avm.Articles = new List<Article>();
            avm.CurrentPage = page;
            avm.Articles = _ctx.Articles.GetArticles(page * ARTICLES_PER_PAGE, ARTICLES_PER_PAGE);
            avm.TotalPage = _ctx.Articles.GetArticlesCount() / ARTICLES_PER_PAGE;

            return View("Index", avm);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public IActionResult PanelListArticles()
 {
     List<Article> lstArticles = _ctx.Admin.Articles.GetArticles(0, 50);
     ArticlesViewModel avm = new ArticlesViewModel();
     avm.Articles = lstArticles;
     avm.CurrentPage = 0;
     avm.TotalPage = _ctx.Admin.Articles.GetArticlesCount();
     return PartialView("Admin/Articles/_articlesList", avm);
 }
Ejemplo n.º 3
0
        public IActionResult Category(string category, int page = 0)
        {
            if (string.IsNullOrWhiteSpace(category))
                return RedirectToAction("index");

            ArticlesViewModel avm = new ArticlesViewModel();

            avm.Articles = new List<Article>();
            avm.CurrentPage = page;
            avm.Articles = _ctx.Articles.GetCategoryArticles(category, page * ARTICLES_PER_PAGE, ARTICLES_PER_PAGE);
            avm.TotalPage = _ctx.Articles.GetCategoryArticlesCount(category) / ARTICLES_PER_PAGE;

            return View("Index", avm);
        }
Ejemplo n.º 4
0
        public IActionResult Index(int page = 0)
        {
            ArticlesViewModel avm = new ArticlesViewModel();
            avm.Message = "Blog de MrTryHard";
            avm.Articles = new List<Article>();

            //avm.Articles = ArticlesCommand.GetArticles(page * ARTICLES_PER_PAGE, ARTICLES_PER_PAGE);
            avm.Articles = _ctx.Articles.GetArticles(page * ARTICLES_PER_PAGE, ARTICLES_PER_PAGE);

            avm.CurrentPage = page;
            avm.TotalPage = _ctx.Articles.GetArticlesCount() / ARTICLES_PER_PAGE;
            return View(avm);
        }