Exemple #1
0
        //[Authorize(Roles = "PR")]
        public ActionResult AddBlogPost()
        {
            var ops = new BlogPostOperations();
            var vm  = new AddBlogPostViewModel(ops.GetAllCategories());

            return(View(vm)); // Author is currently being populated as the user identity email. Switch to username?
        }
Exemple #2
0
        public ActionResult EditPost(int id)
        {
            var ops = new BlogPostOperations();
            var vm  = new EditPostViewModel(ops.GetAllCategories());

            vm.BlogPost = ops.GetPostByID(id).FirstOrDefault();

            return(View(vm));
        }
Exemple #3
0
        public ActionResult DisplayPostsWithStatus2()
        {
            var ops = new BlogPostOperations();
            var vm  = new HomeIndexViewModel();

            vm.BlogPosts   = ops.GetPostsWithStatus2();
            vm.Categories  = ops.GetAllCategories();
            vm.StaticPages = ops.GetAllStaticPages();

            return(View(vm));
        }
Exemple #4
0
        public ActionResult ListPostsByTag(int id)
        {
            var ops = new BlogPostOperations();
            var vm  = new HomeIndexViewModel();

            vm.BlogPosts   = ops.GetPostsByTagID(id);
            vm.Categories  = ops.GetAllCategories();
            vm.StaticPages = ops.GetAllStaticPages();

            return(View("Index", vm));
        }
Exemple #5
0
        public ActionResult ListSinglePost(int id)
        {
            // Added a new view in order to view the whole post without the truncation from dotdotdot.
            // Also for viewing comments
            var ops = new BlogPostOperations();
            //var vm = new HomeIndexViewModel();
            var vm = new ListSinglePostViewModel();

            vm.BlogPost    = ops.GetPostByID(id).FirstOrDefault();
            vm.Categories  = ops.GetAllCategories();
            vm.StaticPages = ops.GetAllStaticPages();
            //vm.RouteID = ; can we use this to go back to the right routed page on the home index?

            return(View(vm));
        }
Exemple #6
0
        public ActionResult Index(int id = 0)
        {
            var ops = new BlogPostOperations();
            var vm  = new HomeIndexViewModel();

            //vm.BlogPosts = ops.GetBlogPosts();
            vm.Categories  = ops.GetAllCategories();
            vm.StaticPages = ops.GetAllStaticPages();
            // paging
            var posts = ops.GetBlogPosts();

            vm.PostTotal = posts.Count;
            vm.RouteID   = id;
            vm.BlogPosts = posts.Skip(id * 5).Take(5).ToList();

            return(View(vm));
        }
Exemple #7
0
        public List <Category> Get()
        {
            var ops = new BlogPostOperations();

            return(ops.GetAllCategories());
        }