summaryrefslogtreecommitdiff
path: root/Project-Unite/Models/ForumCategory.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-17 09:52:57 -0400
committerMichael <[email protected]>2017-05-17 09:52:57 -0400
commit7e54c9b3fad48c7bce1134f7937924f120f1999c (patch)
treef922e35184e7e9f0cc90d0dc11f4541a414d35bd /Project-Unite/Models/ForumCategory.cs
parent1abd027bdbd55fac59ad5bcdd8df301bb2499204 (diff)
downloadproject-unite-7e54c9b3fad48c7bce1134f7937924f120f1999c.tar.gz
project-unite-7e54c9b3fad48c7bce1134f7937924f120f1999c.tar.bz2
project-unite-7e54c9b3fad48c7bce1134f7937924f120f1999c.zip
More fixes, specifically with forum
Diffstat (limited to 'Project-Unite/Models/ForumCategory.cs')
-rw-r--r--Project-Unite/Models/ForumCategory.cs50
1 files changed, 29 insertions, 21 deletions
diff --git a/Project-Unite/Models/ForumCategory.cs b/Project-Unite/Models/ForumCategory.cs
index da5a9c9..52e184e 100644
--- a/Project-Unite/Models/ForumCategory.cs
+++ b/Project-Unite/Models/ForumCategory.cs
@@ -39,28 +39,12 @@ namespace Project_Unite.Models
public virtual string Parent { get; set; }
- public ForumPermission[] Permissions { get
- {
- var db = new ApplicationDbContext();
- return db.ForumPermissions.Where(x => x.CategoryId == this.Id).ToArray();
- }
- }
- }
-
- public class ForumPermission
- {
- [Key]
- public string Id { get; set; }
-
- [Required]
- public string CategoryId { get; set; }
-
- [Required]
- public string RoleId { get; set; }
+ public int AdminPermission { get; set; }
+ public int DeveloperPermission { get; set; }
+ public int ModeratorPermission { get; set; }
+ public int MemberPermission { get; set; }
- [Required]
- [EnumDataType(typeof(PermissionPreset))]
- public PermissionPreset Permissions { get; set; }
+ public bool VisibleToGuests { get; set; }
}
public class ForumPost
@@ -124,8 +108,32 @@ namespace Project_Unite.Models
public bool IsLocked { get; set; }
+ public int Priority
+ {
+ get
+ {
+ int priority = 0;
+ if (IsSticky)
+ priority = 1;
+ if (IsAnnounce)
+ priority = 2;
+ if (IsSticky && IsAnnounce)
+ priority = 3;
+ return priority;
+ }
+ }
+
public DateTime StartedAt { get; set; }
public string Subject { get; set; }
+ public bool ShouldShow
+ {
+ get
+ {
+ if (IsUnlisted == true)
+ return HttpContext.Current.User?.Identity?.IsModerator() == true;
+ return true;
+ }
+ }
public string AuthorId { get; set; }
public bool IsSticky { get; set; }
public bool IsAnnounce { get; set; }