@@ -22,12 +22,12 @@ public class CategoryRepository : ICategoryRepository
22
22
/// <returns>List of items</returns>
23
23
public IEnumerable < CategoryItem > Find ( int take = 10 , int skip = 0 , string filter = "" , string order = "" )
24
24
{
25
- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . ViewPublicPosts ) )
26
- throw new System . UnauthorizedAccessException ( ) ;
25
+ if ( ! Security . IsAuthorizedTo ( Rights . ViewPublicPosts ) )
26
+ throw new UnauthorizedAccessException ( ) ;
27
27
28
28
// get post categories with counts
29
29
var items = new List < CategoryItem > ( ) ;
30
- foreach ( var p in BlogEngine . Core . Post . ApplicablePosts )
30
+ foreach ( var p in Post . ApplicablePosts )
31
31
{
32
32
foreach ( var c in p . Categories )
33
33
{
@@ -66,20 +66,20 @@ public IEnumerable<CategoryItem> Find(int take = 10, int skip = 0, string filter
66
66
/// </summary>
67
67
/// <param name="id">Item id</param>
68
68
/// <returns>Object</returns>
69
- public Data . Models . CategoryItem FindById ( Guid id )
69
+ public CategoryItem FindById ( Guid id )
70
70
{
71
- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . ViewPublicPosts ) )
72
- throw new System . UnauthorizedAccessException ( ) ;
71
+ if ( ! Security . IsAuthorizedTo ( Rights . ViewPublicPosts ) )
72
+ throw new UnauthorizedAccessException ( ) ;
73
73
74
74
// get post categories
75
- var items = new List < Data . Models . CategoryItem > ( ) ;
76
- foreach ( var p in BlogEngine . Core . Post . ApplicablePosts )
75
+ var items = new List < CategoryItem > ( ) ;
76
+ foreach ( var p in Post . ApplicablePosts )
77
77
{
78
78
foreach ( var c in p . Categories )
79
79
{
80
80
var tmp = items . FirstOrDefault ( cat => cat . Id == c . Id ) ;
81
81
if ( tmp == null )
82
- items . Add ( new Data . Models . CategoryItem { Id = c . Id , Parent = OptionById ( c . Parent ) , Title = c . Title , Description = c . Description , Count = 1 } ) ;
82
+ items . Add ( new CategoryItem { Id = c . Id , Parent = OptionById ( c . Parent ) , Title = c . Title , Description = c . Description , Count = 1 } ) ;
83
83
else
84
84
tmp . Count ++ ;
85
85
}
@@ -89,7 +89,7 @@ public Data.Models.CategoryItem FindById(Guid id)
89
89
{
90
90
var x = items . Where ( i => i . Id == c . Id ) . FirstOrDefault ( ) ;
91
91
if ( x == null )
92
- items . Add ( new Data . Models . CategoryItem { Id = c . Id , Parent = OptionById ( c . Parent ) , Title = c . Title , Description = c . Description , Count = 0 } ) ;
92
+ items . Add ( new CategoryItem { Id = c . Id , Parent = OptionById ( c . Parent ) , Title = c . Title , Description = c . Description , Count = 0 } ) ;
93
93
}
94
94
return items . Where ( c => c . Id == id ) . FirstOrDefault ( ) ;
95
95
}
@@ -98,10 +98,10 @@ public Data.Models.CategoryItem FindById(Guid id)
98
98
/// </summary>
99
99
/// <param name="item">Post</param>
100
100
/// <returns>Saved item with new ID</returns>
101
- public Data . Models . CategoryItem Add ( CategoryItem item )
101
+ public CategoryItem Add ( CategoryItem item )
102
102
{
103
- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . CreateNewPosts ) )
104
- throw new System . UnauthorizedAccessException ( ) ;
103
+ if ( ! Security . IsAuthorizedTo ( Rights . CreateNewPosts ) )
104
+ throw new UnauthorizedAccessException ( ) ;
105
105
106
106
var cat = ( from c in Category . Categories . ToList ( ) where c . Title == item . Title select c ) . FirstOrDefault ( ) ;
107
107
if ( cat != null )
@@ -126,8 +126,8 @@ public Data.Models.CategoryItem Add(CategoryItem item)
126
126
/// <returns>True on success</returns>
127
127
public bool Update ( CategoryItem item )
128
128
{
129
- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . EditOwnPosts ) )
130
- throw new System . UnauthorizedAccessException ( ) ;
129
+ if ( ! Security . IsAuthorizedTo ( Rights . EditOwnPosts ) )
130
+ throw new UnauthorizedAccessException ( ) ;
131
131
132
132
var cat = ( from c in Category . Categories . ToList ( ) where c . Title == item . Title && c . Id != item . Id select c ) . FirstOrDefault ( ) ;
133
133
if ( cat != null )
@@ -149,8 +149,8 @@ public bool Update(CategoryItem item)
149
149
/// <returns>True on success</returns>
150
150
public bool Remove ( Guid id )
151
151
{
152
- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . DeleteOwnPosts ) )
153
- throw new System . UnauthorizedAccessException ( ) ;
152
+ if ( ! Security . IsAuthorizedTo ( Rights . DeleteOwnPosts ) )
153
+ throw new UnauthorizedAccessException ( ) ;
154
154
try
155
155
{
156
156
var core = ( from c in Category . Categories . ToList ( ) where c . Id == id select c ) . FirstOrDefault ( ) ;
0 commit comments