예제 #1
0
        // GET: Admin
        //[Authorize(Roles = "Admin")]
        public ActionResult Index()
        {
            var manager = new BlogManager();
            var response = manager.GetAllApprovedPosts();

            return View(response.Data);
        }
예제 #2
0
        public ActionResult CreateWebpage(Webpage page)
        {
            var manager = new BlogManager();
            manager.AddWebpage(page);

            return RedirectToAction("Index/"+ page.Title, "Static");
        }
예제 #3
0
        // GET: Static
        public ActionResult Index(string Title)
        {
            var manager = new BlogManager();
            var page = manager.GetWebpageByTitle(Title).Data;

            return View(page);
        }
예제 #4
0
        public ActionResult Approve(Array checkedIds)
        {
            var postID = new List<int>();

            foreach (string p in checkedIds)
            {
                postID.Add(int.Parse(p));
            }

            var manager = new BlogManager();
            manager.ApprovePost(postID);

            return RedirectToAction("Index");
        }
예제 #5
0
        public ActionResult CreatePost(Models.HTMLContent x)
        {
            if(ModelState.IsValid)
            {
            var newPost = new Post();
            newPost.Content = x.HtmlContent;
            newPost.Title = x.Title;
            newPost.IsApproved = false;
            newPost.DatePosted = DateTime.Now;

            var manager = new BlogManager();
            var response = manager.AddPost(newPost);

            return View("Pending");
            }
            else
            {
                return View("NewAdminPost");
            }
        }
예제 #6
0
        public ActionResult CreatePost(HTMLContent x)
        {
            var newPost = new Domain.Post();

            newPost.Content = x.HtmlContent;
            newPost.Title = x.Title;
            newPost.IsApproved = true;
            newPost.DatePosted = DateTime.Now;

            if (ModelState.IsValid)
            {
                var manager = new BlogManager();
                var response = manager.AddPost(newPost);

                return RedirectToAction("Index");
            }
            else
            {
                return View("OwnerAddPost");
            }
        }
예제 #7
0
 public ActionResult UnapprovedPosts()
 {
     var manager = new BlogManager();
     var data = manager.GetAllUnapprovedPosts().Data;
     return View(data);
 }
예제 #8
0
        public ActionResult OwnerDelete(Array checkedBoxes)
        {
            var postID = new List<int>();
            foreach(string ID in checkedBoxes)
            {
                postID.Add(int.Parse(ID));
            }
            var manager = new BlogManager();
            manager.DeletePost(postID);

            return RedirectToAction("Index");
        }
 public List<Post> Get()
 {
     var manager = new BlogManager();
     var data = manager.GetAllUnapprovedPosts().Data;
     return data;
 }