public ActionResult ApprovePost(int id) { var ops = new BlogPostOperations(); ops.SetPostTo1(id); return RedirectToAction("DisplayPostsWithStatus0"); }
public ActionResult DeletePost(int id) { var ops = new BlogPostOperations(); ops.DeletePost(id); return RedirectToAction("Index", "Home"); }
public ActionResult DisplayStaticPage(int id) { var ops = new BlogPostOperations(); var vm = new HomeIndexViewModel(); var newStaticPage = ops.GetStaticPageByID(id); return View(newStaticPage); }
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); }
public ActionResult AddUserComment(AddUserCommentViewModel vm) { var ops= new BlogPostOperations(); var userComment = new UserComment(); userComment.UserCommentContent = vm.UserCommentContent; userComment.UserCommentDate = DateTime.Parse(vm.UserCommentDate); userComment.UserCommentUserName = vm.UserCommentUserName; ops.AddNewUserComment(userComment, vm.PostID); return RedirectToAction("ListSinglePost", new {id= vm.PostID}); }
public HttpResponseMessage Post(Category newCategory) { var ops = new BlogPostOperations(); ops.AddCategory(newCategory); var response = Request.CreateResponse(HttpStatusCode.Created, newCategory); string uri = Url.Link("DefaultApi", new {id = newCategory.CategoryID}); response.Headers.Location = new Uri(uri); return response; }
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); }
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); }
public ActionResult AddBlogPost(BlogPost blogPost) { var ops = new BlogPostOperations(); if (User.IsInRole("Admin")) { // Admin add post, post goes to table with status of 1 ops.AddNewBlogPost(blogPost); return RedirectToAction("Index", "Home"); } if (User.IsInRole("PR")) { // PR add post, post goes to table with status of 0 ops.PRAddNewBlogPost(blogPost); return RedirectToAction("Index", "Home"); } // somehow a non-authenticated add. nothing goes to data. (necessary?) return RedirectToAction("Index", "Home"); }
public List<Tag> Get() { var ops = new BlogPostOperations(); return ops.GetAllTags(); }
public List<Category> Get() { var ops = new BlogPostOperations(); return ops.GetAllCategories(); }
public ActionResult EditPost(BlogPost editedPost) { var ops = new BlogPostOperations(); ops.EditPost(editedPost); return RedirectToAction("Index", "Home"); }
public ActionResult EditPost(int id) { var ops = new BlogPostOperations(); var vm = new EditPostViewModel(ops.GetAllCategories()); vm.BlogPost = ops.GetPostByID(id).FirstOrDefault(); return View(vm); }
public ActionResult EditSingleStaticPage(int id) { var ops = new BlogPostOperations(); StaticPage newStaticPage = ops.GetStaticPageByID(id); return View("EditSingleStaticPage", newStaticPage); }
public ActionResult DisplayPostsWithStatus0() { var ops = new BlogPostOperations(); var vm = new HomeIndexViewModel(); vm.BlogPosts = ops.GetPostsWithStatus0(); vm.Categories = ops.GetAllCategories(); vm.StaticPages = ops.GetAllStaticPages(); return View(vm); }
public ActionResult EditStaticPage() { //need a list of static pages var ops = new BlogPostOperations(); var vm = new HomeIndexViewModel(); vm.StaticPages = ops.GetAllStaticPages(); return View(vm); }
public ActionResult EditStaticPage(StaticPage editedStaticPage) { var ops = new BlogPostOperations(); ops.EditStaticPage(editedStaticPage); //what view should be returned? return RedirectToAction("Index", "Home"); }
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? }