summaryrefslogtreecommitdiff
path: root/Project-Unite/Models
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-27 15:47:54 -0400
committerMichael <[email protected]>2017-03-27 15:47:54 -0400
commit93734dd552b9c95da23b517ea1f65854f22c68f6 (patch)
treebe392b5c2c05483c70fd1aa06788bb31b297baef /Project-Unite/Models
parentfd5302fca4ebeba412a7015955f484b3fcbf142f (diff)
downloadproject-unite-93734dd552b9c95da23b517ea1f65854f22c68f6.tar.gz
project-unite-93734dd552b9c95da23b517ea1f65854f22c68f6.tar.bz2
project-unite-93734dd552b9c95da23b517ea1f65854f22c68f6.zip
Unread posts backend.
Diffstat (limited to 'Project-Unite/Models')
-rw-r--r--Project-Unite/Models/IdentityModels.cs18
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; }