diff options
Diffstat (limited to 'Project-Unite/Models')
| -rw-r--r-- | Project-Unite/Models/IdentityModels.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs index bb55d50..6cfb821 100644 --- a/Project-Unite/Models/IdentityModels.cs +++ b/Project-Unite/Models/IdentityModels.cs @@ -39,6 +39,16 @@ namespace Project_Unite.Models } + public ForumPost[] UnreadPosts + { + get + { + var db = new ApplicationDbContext(); + var posts = db.ForumPosts.Where(x => db.ReadPosts.FirstOrDefault(y => y.UserId == this.Id && y.PostId == x.Id) == null); + return posts.ToArray(); + } + } + public Role HighestRole { get @@ -204,6 +214,7 @@ namespace Project_Unite.Models return new ApplicationDbContext(); } + public DbSet<ReadPost> ReadPosts { get; set; } public DbSet<Download> Downloads { get; set; } public DbSet<DatabaseBackup> Backups { get; set; } public DbSet<AssetBackup> AssetBackups { get; set; } @@ -230,6 +241,13 @@ namespace Project_Unite.Models public DbSet<View> Views { get; set; } } + public class ReadPost + { + public string Id { get; set; } + public string PostId { get; set; } + public string UserId { get; set; } + } + public class UserPost { public string Id { get; set; } |
