예제 #1
0
        public ActionResult BlogByCategoryID(int CategoryID, int Page)
        {
            var ops = new FITlosophiOperations();
            var blogVM = new BlogViewModel();
            var posts = ops.GetAllPostsByCategory(CategoryID);

            blogVM.Categories = ops.GetAllCategories();
            blogVM.TotalPosts = posts.Count();
            blogVM.Posts = posts.Skip((4 * Page) - 4).Take(10).ToList();
            blogVM.Page = Page;

            // Calculate the total number of pages
            blogVM.TotalNumberOfPages = blogVM.TotalPosts/4;
            if ((blogVM.TotalPosts % 4) > 0)
            {
                blogVM.TotalNumberOfPages++;
            }

            //Create paging url based on controller action
            if (Page < blogVM.TotalNumberOfPages)
            {
                blogVM.OlderUrl = "/Home/BlogByCategoryID?CategoryID=" + CategoryID + "&Page=" + (Page + 1);
            }

            if (Page > 1)
            {
                blogVM.NewUrl = "/Home/BlogByCategoryID?CategoryID=" + CategoryID + "&Page=" + (Page - 1);
            }

            return View("Index", blogVM);
        }
예제 #2
0
        public ActionResult EditPost(Post post)
        {
            var update = new FITlosophiOperations();

            update.EditPost(post);

            return View("ManagePosts");
        }
예제 #3
0
        public ActionResult EditPost(int id)
        {
            var read = new FITlosophiOperations();

            var postToEdit = read.GetPostByID(id);

            return View(postToEdit);
        }
예제 #4
0
        public ActionResult EditPage(StaticPage page)
        {
            var update = new FITlosophiOperations();

            update.EditPage(page);

            return View("ManagePages");
        }
예제 #5
0
        public ActionResult EditPage(int id)
        {
            var read = new FITlosophiOperations();

            var pageToEdit = read.GetPageByID(id);

            return View(pageToEdit);
        }
        public void PublishPost(int PostID)
        {
            var post = new Post();
            post.PostID = PostID;

            var update = new FITlosophiOperations();

            update.PublishPost(post);
        }
        public List<Category> Get()
        {
            var read = new FITlosophiOperations();

            return read.GetAllCategories();
        }
예제 #8
0
        public ActionResult PostPost(Post post)
        {
            var create = new FITlosophiOperations();

            create.AddPost(post);

            if (User.IsInRole("Admin"))
            {
                return View("ManagePosts");
            }

            return RedirectToAction("Index", "Home");
        }
        public Post GetPostByID(int PostID)
        {
            var read = new FITlosophiOperations();

            return read.GetPostByID(PostID);
        }
예제 #10
0
        public void EditPost(Post Post)
        {
            var update = new FITlosophiOperations();

            update.EditPost(Post);
        }
예제 #11
0
        public List<HashTag> Get()
        {
            var read = new FITlosophiOperations();

            return read.GetAllTags();
        }
        public List<Post> GetPostByAmount(int amount)
        {
            var read = new FITlosophiOperations();

            return read.GetPostsByAmount(amount);
        }
예제 #13
0
 public ActionResult StaticPage(int staticPageID)
 {
     var ops = new FITlosophiOperations();
     var staticPage = ops.GetPageByID(staticPageID);
     return View(staticPage);
 }
예제 #14
0
        public ActionResult BlogDetail(int postID)
        {
            var blogDetailVM = new BlogDetailViewModel();

            var ops = new FITlosophiOperations();

            blogDetailVM.UserSelectedPost = ops.GetPostByID(postID);
            blogDetailVM.Categories = ops.GetAllCategories();
            var readMorePosts = ops.GetPostsByAmount(10);

            blogDetailVM.Posts = readMorePosts.Where(p => p.PostID != postID).ToList();

            return View(blogDetailVM);
        }
예제 #15
0
        public void Post(Category category)
        {
            var post = new FITlosophiOperations();

            post.AddNewCategory(category);
        }
        public List<Post> GetAllPostsByCategory(int categoryID)
        {
            var read = new FITlosophiOperations();

            return read.GetAllPostsByCategory(categoryID);
        }
예제 #17
0
 public void DeletePage(int StaticPageID)
 {
     var delete = new FITlosophiOperations();
     delete.DeletePage(StaticPageID);
 }
        public List<Post> GetPostsByTagID(int tagID)
        {
            var read = new FITlosophiOperations();

            return read.GetPostsByTagID(tagID);
        }
예제 #19
0
        public void EditPage(StaticPage StaticPage)
        {
            var update = new FITlosophiOperations();

               update.EditPage(StaticPage);
        }
예제 #20
0
 public void DeletePost(int PostID)
 {
     var delete = new FITlosophiOperations();
     delete.DeletePost(PostID);
 }
예제 #21
0
        public List<StaticPage> GetAllPageSummaries()
        {
            var read = new FITlosophiOperations();

            return read.GetAllPageSummaries();
        }
예제 #22
0
        public List<Post> GetAllPostSummaries()
        {
            var read = new FITlosophiOperations();

            return read.GetAllPostSummaries();
        }
예제 #23
0
        public StaticPage GetPageByID(int PageID)
        {
            var read = new FITlosophiOperations();

            return read.GetPageByID(PageID);
        }
예제 #24
0
        public void Post(Post post)
        {
            var create = new FITlosophiOperations();

            create.AddPost(post);
        }
예제 #25
0
        public void PublishPage(int StaticPageID)
        {
            var update = new FITlosophiOperations();

            update.PublishPage(StaticPageID);
        }
예제 #26
0
        public void PublishPostWithSchedule(Post Post)
        {
            var update = new FITlosophiOperations();

            update.PublishPost(Post);
        }
예제 #27
0
        public ActionResult PostPage(StaticPage page)
        {
            var create = new FITlosophiOperations();

            create.AddStaticPage(page);

            if (User.IsInRole("Admin"))
            {
                return View("ManagePages");
            }

            return RedirectToAction("Index", "Home");
        }