Example #1
0
 public ActionResult ViewCategoryById(int id)
 {
     CategoryService service = new CategoryService();
     Category cat = service.GetById(id);
     ViewCategoryModel model = new ViewCategoryModel()
     {
         Category = cat,
         SubCategories = cat.Categories1.ToList(),
     };
     return View(model);
 }
Example #2
0
        public ActionResult ViewCategory(string category, int Page=1)
        {
            CategoryService service = new CategoryService();
            Category cat = service.GetByStaticName(category);
            NewsService newsSvc = new NewsService();
            string status = EntityStates.Activated.ToString();

            var paged = newsSvc.GetPaged(p=>p.Status == status && p.News_CategoryID ==  cat.CategoryID,
                new IOrderByClause<News>[] {new OrderByClause<News, DateTime>(p=>p.UpdateDate.Value, SortDirection.Decending)},
                Page, 20
                );

            ViewCategoryModel model = new ViewCategoryModel()
            {
                Category = cat,
                SubCategories = cat.Categories1.ToList(),
                LastedNewsPaged = paged,
                LastestNews = paged.ToList(),
            };
            return View(model);
        }