summaryrefslogtreecommitdiff
path: root/Project-Unite/Models/IdentityModels.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-24 12:49:56 -0400
committerMichael <[email protected]>2017-03-24 12:49:56 -0400
commit016128611cf66501e811dca74f43a35d5385679c (patch)
tree7349c14acbbb4e4aa38677fcff03d2ae4345081d /Project-Unite/Models/IdentityModels.cs
parentf7767a660c1ab2f5e98d7bf8ad0a7bc9eb801ddf (diff)
downloadproject-unite-016128611cf66501e811dca74f43a35d5385679c.tar.gz
project-unite-016128611cf66501e811dca74f43a35d5385679c.tar.bz2
project-unite-016128611cf66501e811dca74f43a35d5385679c.zip
Add notification button and db column
Diffstat (limited to 'Project-Unite/Models/IdentityModels.cs')
-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 83ea777..a3dde10 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -106,6 +106,23 @@ namespace Project_Unite.Models
}
}
+ public Notification[] Notifications
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+ return db.Notifications.Where(x => x.UserId == this.Id).ToArray();
+ }
+ }
+
+ public int UnreadNotifications
+ {
+ get
+ {
+ return Notifications.Where(x => x.IsRead == false).Count();
+ }
+ }
+
public UserFollow[] Followed
{
get
@@ -149,6 +166,7 @@ namespace Project_Unite.Models
return new ApplicationDbContext();
}
+ public DbSet<Notification> Notifications { get; set; }
public DbSet<UserFollow> Follows { get; set; }
public DbSet<UserPost> UserPosts { get; set; }
public DbSet<ForumPostEdit> ForumPostEdits { get; set; }