public IActionResult Blogs()
        {
            BlogsVM blogsVM = new BlogsVM
            {
                Blogs = _work.Blogs.GetAll()
            };

            return(View(blogsVM));
        }
Example #2
0
        public IActionResult BlogsCommentView()
        {
            ViewData["BlogId"] = new SelectList(_work.Blogs.GetAll(), "Id", "Id");

            // ViewData["BlogId"] = new SelectList(_work.Products.GetAll(), "Id", "Id");

            BlogsVM blogsDetailsvm = new BlogsVM();

            return(PartialView("_CommentView", blogsDetailsvm));
        }
Example #3
0
        public IActionResult Blogs()
        {
            BlogsVM blogsVM = new BlogsVM
            {
                Blogs       = _work.Blogs.GetAll().OrderBy(x => x.Order).ToList(),
                singleblogs = _work.Blogs.GetWithSingleImage(),
                lastImage   = _work.Blogs.GetWithLatImage(),
            };

            return(View(blogsVM));
        }
Example #4
0
        public IActionResult BlogsCommentCreateView(int id)
        {
            BlogsVM blogsDetailsvm = new BlogsVM
            {
                BlogsItem    = _work.Blogs.Get(id),
                blogcomment  = _work.BlogComment.GetAll(),
                commentCount = _work.BlogComment.GetWithAllComment()
            };

            return(PartialView("_CommentView", blogsDetailsvm));
        }
Example #5
0
        public IActionResult BlogsDetails(int id)
        {
            BlogsVM blogsDetailsvm = new BlogsVM
            {
                BlogsItem    = _work.Blogs.Get(id),
                blogcomment  = _work.BlogComment.GetAll(),
                commentCount = _work.BlogComment.GetWithAllComment()
            };

            return(View(blogsDetailsvm));
        }
Example #6
0
        public IActionResult BlogsDetails(int id)
        {
            var result = _context.BlogComments.ToList();

            ViewBag.comment = result.Count();

            BlogsVM blogsDetailsvm = new BlogsVM
            {
                BlogsItem    = _work.Blogs.Get(id),
                blogcomment  = _work.BlogComment.GetAll(),
                commentCount = _work.BlogComment.GetWithAllComment()
            };

            return(View(blogsDetailsvm));
        }
Example #7
0
        public IActionResult BlogsCommentCreate(BlogsVM blogsVM)
        {
            if (ModelState.IsValid)
            {
                BlogComment blogComment = new BlogComment
                {
                    FullName = blogsVM.FullName,
                    Email    = blogsVM.Email,
                    Comment  = blogsVM.Comment,
                    BlogId   = blogsVM.BlogId,
                };
                _work.BlogComment.Add(blogComment);
                _work.Complete();

                ViewData["BlogId"] = new SelectList(_work.Blogs.GetAll(), "Id", "Id");
                return(PartialView("_CommentView", blogsVM));
            }
            return(PartialView("_CommentView", blogsVM));
        }