PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/admin/Trash.aspx.cs

#
C# | 56 lines | 46 code | 7 blank | 3 comment | 1 complexity | 0a41c08a3027ec1ab66423380bf2f65e MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. namespace Admin
  2. {
  3. using System;
  4. using System.Collections;
  5. using System.Web.Services;
  6. using BlogEngine.Core;
  7. using BlogEngine.Core.Json;
  8. public partial class Trash : System.Web.UI.Page
  9. {
  10. protected override void OnLoad(EventArgs e)
  11. {
  12. base.OnLoad(e);
  13. Security.DemandUserHasRight(BlogEngine.Core.Rights.AccessAdminPages, true);
  14. }
  15. /// <summary>
  16. /// Number of items in the list
  17. /// </summary>
  18. protected static int TrashCounter { get; set; }
  19. [WebMethod]
  20. public static IEnumerable LoadTrash(string trashType)
  21. {
  22. Security.DemandUserHasRight(BlogEngine.Core.Rights.AccessAdminPages, true);
  23. var tType = TrashType.All;
  24. switch (trashType)
  25. {
  26. case "Post":
  27. tType = TrashType.Post;
  28. break;
  29. case "Page":
  30. tType = TrashType.Page;
  31. break;
  32. case "Comment":
  33. tType = TrashType.Comment;
  34. break;
  35. default:
  36. break;
  37. }
  38. var trashList = JsonTrashList.GetTrash(tType);
  39. TrashCounter = trashList.Count;
  40. return trashList;
  41. }
  42. [WebMethod]
  43. public static JsonResponse ProcessTrash(string action, string[] vals)
  44. {
  45. Security.DemandUserHasRight(BlogEngine.Core.Rights.AccessAdminPages, true);
  46. return JsonTrashList.Process(action, vals);
  47. }
  48. }
  49. }