Guest User

Untitled

a guest
Jul 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. // Hide 'posts'
  2. [AcceptVerbs(HttpVerbs.Post)]
  3. public ActionResult Hide (int id)
  4. {
  5. var post = db.tb_SH_Forum_Posts.Single(p => p.Post_ID == id);
  6. post.Private_ID = (post.Private_ID == 1) ? 2 : 1;
  7. db.SaveChanges();
  8. RedirectToAction("Details", new { id = post.Thread_ID });
  9. }
  10.  
  11. @foreach
  12. (var post in Model.tb_SH_Forum_Posts.Where(w => w.Private_ID == 1).OrderBy(o => o.Post_Date))
  13. {
  14. using (Html.BeginForm("Hide", "Post", new { id = post.Post_ID }))
  15. {
  16. <input type="submit" name = "hidePosts" value="Hide" />
  17. }
  18.  
  19. <div class ="post">
  20. <fieldset>
  21. <p class="post_details">At @post.Post_Date By @(post.Anon == true ? "Anonymous" : post.Username)
  22. </p>
  23. @post.Post_Desc
  24.  
  25. </fieldset>
  26. </div>}
  27.  
  28. return RedirectToAction("Details", new { id = post.Thread_ID })
Add Comment
Please, Sign In to add comment