public ActionResult FirstLevCategoryList(string categoryUrl, string subCategoryUrl, string subSubCategoryUrl, int?page) { ProjectListModel model = new ProjectListModel(); //model.MostViewed = la.MostViewed(11, 20); //model.CrumbLinkList = new List<CustomHtmlLink>(); //AppStatic.Categories.Where(c => c.CategoryUrl == categoryUrl); PageModel.Title = ""; PageModel.Description = ""; PageModel.Author = ""; PageModel.Keywords = ""; string url = HttpContext.Request.RawUrl; //int categoryRowId = DIYFEHelper.GetCatigoryRowId(categoryUrl, "", ""); Category cat = DIYFEHelper.GetCatigory(categoryUrl, subCategoryUrl, subSubCategoryUrl); model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(cat, linkPrefix); model.RelatedTreeView = DIYFEHelper.GenerateRelatedTreeView(cat, linkPrefix); using (var db = new DIYFE.EF.DIYFEEntities()) { //BASED ON CAT model.ArticleList = db.Articles.Include("ArticleComments").Where(a => a.ArticleTypeId == 1 && a.Category.CategoryId == cat.CategoryId).OrderBy(a => a.CreatedDate); model.PagedArticle = model.ArticleList.Concat(db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleTypeId == 2 && a.Category.CategoryId == cat.CategoryId).OrderBy(a => a.ArticleStatus.Any(aStat => aStat.StatusId == 1))).OrderByDescending(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); //CHECK PAGING //model.ArticleList = db.Articles.Include("ArticleComments").Where(a => a.ArticleTypeId == 1); //model.PagedArticle = model.ArticleList.Concat(db.Articles.Include("ArticleComments").Include("ArticleStatus.StatusType").Where(a => a.ArticleTypeId == 2)).OrderBy(a => a.CreatedDate).ToPagedList(page ?? 1, pageSize); } //model.PagedArticle = model.ArticleList.ToPagedList(page ?? 1, pageSize); return(View(model)); }
public ActionResult PostDetails(string html) { int categoryRowId = 0; ArticleModel model = new ArticleModel(); Category cat = new Category(); using (var db = new DIYFE.EF.DIYFEEntities()) { model.Article = db.Articles.Include("ArticleComments").Where(a => a.URLLink == html + ".html").FirstOrDefault(); } if (model.Article != null) { cat = DIYFEHelper.GetCatigroy(model.Article.CategoryRowId); DIYFELib.Tracking.InsertArticleViewRequest(model.Article.ArticleId); // model.Comments = la.ArticleComments(model.Article.ArticleId); // model.MostViewed = la.MostViewed(11, 20); model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(cat, linkPrefix); model.RelatedTreeView = DIYFEHelper.GenerateRelatedTreeView(cat, linkPrefix); PageModel.Title = model.Article.Title; PageModel.Description = model.Article.Description; PageModel.Author = model.Article.Author; PageModel.Keywords = model.Article.Keywords; } else { //JUST TO GET BY -- REPLACE WITH 404 SOULATION model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(new Category(), linkPrefix); model.Article = new Article(); model.Comments = new List <ArticleComment>(); //model.RelatedTreeView = DIYFEHelper.GenerateTreeViewThirdLev(model.Article.CategoryRowId, linkPrefix); PageModel.Title = ""; PageModel.Description = ""; PageModel.Author = ""; PageModel.Keywords = ""; } // model.Comments = la.ArticleComments(model.Article.ArticleId); //model.MostViewed = la.MostViewed(11, 20); // model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(categoryRowId, linkPrefix); model.RelatedTreeView = DIYFEHelper.GenerateTreeViewThirdLev(cat, linkPrefix); ////PageModel.Title = model.Article.Title; ////PageModel.Description = model.Article.Description; ////PageModel.Author = model.Article.Author; ////PageModel.Keywords = model.Article.Keywords; return(View(model)); }
public ActionResult FirstLevCategoryList(string categoryUrl) { ListAccess la = new ListAccess(); ArticleModel model = new ArticleModel(); PageModel.ArticleContent.Title = model.ArticleContent.Title; PageModel.ArticleContent.Description = model.ArticleContent.Description; PageModel.ArticleContent.Author = model.ArticleContent.Author; PageModel.ArticleContent.Keywords = model.ArticleContent.Keywords; model.MostViewed = la.MostViewed(11, 20); //model.CrumbLinkList = new List<CustomHtmlLink>(); //AppStatic.Categories.Where(c => c.CategoryUrl == categoryUrl); string url = HttpContext.Request.RawUrl; int catigoryRowId = DIYFEHelper.GetCatigoryRowId(categoryUrl, "", ""); model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryRowId, linkPrefix); model.ArticleList = la.ArticleList(catigoryRowId, 1); model.RelatedTreeView = DIYFEHelper.GenerateRelatedTreeView(catigoryRowId, linkPrefix); return(View(model)); }