PageRenderTime 28ms CodeModel.GetById 25ms app.highlight 1ms 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
 1namespace Admin
 2{
 3    using System;
 4    using System.Collections;
 5    using System.Web.Services;
 6    using BlogEngine.Core;
 7    using BlogEngine.Core.Json;
 8
 9    public partial class Trash : System.Web.UI.Page
10    {
11        protected override void OnLoad(EventArgs e)
12        {
13            base.OnLoad(e);
14
15            Security.DemandUserHasRight(BlogEngine.Core.Rights.AccessAdminPages, true);
16        }
17
18        /// <summary>
19        /// Number of items in the list
20        /// </summary>
21        protected static int TrashCounter { get; set; }
22
23        [WebMethod]
24        public static IEnumerable LoadTrash(string trashType)
25        {
26            Security.DemandUserHasRight(BlogEngine.Core.Rights.AccessAdminPages, true);
27
28            var tType = TrashType.All;
29            switch (trashType)
30            {
31                case "Post":
32                    tType = TrashType.Post;
33                    break;
34                case "Page":
35                    tType = TrashType.Page;
36                    break;
37                case "Comment":
38                    tType = TrashType.Comment;
39                    break;
40                default:
41                    break;
42            }
43            var trashList = JsonTrashList.GetTrash(tType);
44            TrashCounter = trashList.Count;
45            return trashList;
46        }
47
48        [WebMethod]
49        public static JsonResponse ProcessTrash(string action, string[] vals)
50        {
51            Security.DemandUserHasRight(BlogEngine.Core.Rights.AccessAdminPages, true);
52
53            return JsonTrashList.Process(action, vals);
54        }
55    }
56}