示例#1
0
        // GET: EmpPost/Details/5
        public ActionResult Details(int id)
        {
            PostCommentVM postcomment = new PostCommentVM();

            ViewBag.poscategories   = db.PostCategory.Where(x => x.isactive == true).OrderBy(x => x.id).ToList();
            postcomment.commentlist = db.Comments.Where(x => x.postid == id).ToList();
            postcomment.Post        = db.Post.Find(id);
            return(View(postcomment));
        }
        public ActionResult View(int id)
        {
            PostCommentVM postcomment = new PostCommentVM();

            ViewBag.poscategories   = db.PostCategory.Where(x => x.isactive == true).OrderBy(x => x.id).ToList();
            postcomment.commentlist = db.Comments.Where(x => x.postid == id).ToList();
            postcomment.Post        = db.Post.Find(id);
            var categorytype = db.PostCategory.Find(postcomment.Post.postcategoryid);

            ViewBag.postcategoryType = categorytype.name;
            ViewBag.postcategoryid   = categorytype.id;
            return(View(postcomment));
            // return View();
        }