Beispiel #1
0
        public ActionResult ArticleDetails(string articleType, string categoryUrl, string subCategoryUrl, string subSubCategoryUrl, string articleName)
        {
            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 == articleName + ".html").FirstOrDefault();
                model.Article.ViewRequests++;
                db.Entry(model.Article).State = System.Data.EntityState.Modified;
                db.SaveChanges();
            }

            if (model.Article != null)
            {
                cat = StaticConfig.GetCatigroy(model.Article.CategoryRowId);

                model.CrumbLinkList   = StaticConfig.GenerateCrumbLinks(cat, articleType);
                model.RelatedTreeView = StaticConfig.GenerateRelatedTreeView(cat, articleType);

                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 = StaticConfig.GenerateCrumbLinks(new Category(), articleType);
                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 = StaticConfig.GenerateTreeViewThirdLev(cat, articleType);

            ////PageModel.Title = model.Article.Title;
            ////PageModel.Description = model.Article.Description;
            ////PageModel.Author = model.Article.Author;
            ////PageModel.Keywords = model.Article.Keywords;

            return(View(model));
        }