public override Task <ModuleViewComponentResult> OnViewComponentLoad() { ArticlesModel model = new ArticlesModel(this); model.Articles = _articleBusiness.GetArticlesList(Module.ModuleId).OrderByDescending(a => a.ArticleOrder).ToList(); model.PageId = Page.PageId; return(Task.FromResult(ModuleView("Settings", model))); }
public IActionResult List(int id) { List <ArticleModel> model = _articleBusiness .GetArticlesList(id) .OrderByDescending(a => a.ArticleOrder) .Select(a => new ArticleModel() { ArticleId = a.ArticleId, ArticleContent = a.ArticleContent, ArticleOrder = a.ArticleOrder, ImageUrl = a.ImageUrl, Title = a.Title, DateUpdated = a.UpdatedAt.ToString("dd/MM/yyyy HH:mm") }).OrderByDescending(a => a.ArticleOrder) .ThenByDescending(a => a.DateUpdated) .ToList(); return(Json(model)); }
public override Task <ModuleViewComponentResult> OnViewComponentLoad() { ArticlesModel model = new ArticlesModel(this); model.PageName = Page.KeyName; model.PageIndex = PageIndex; // Pagination model.PageSize = model.PageSize == 0 ? 5 : model.PageSize; int skip = model.PageIndex * model.PageSize; model.PageTotal = _articleManager.CountArticles(Module.ModuleId); model.Articles = _articleManager.GetArticlesList(Module.ModuleId, skip, model.PageSize) ?.OrderByDescending(a => a.ArticleOrder) ?.ThenByDescending(a => a.UpdatedAt) ?.ToList() ?? new List <ArticleInfo>(); return(Task.FromResult(ModuleView("Index", model))); }