From 016128611cf66501e811dca74f43a35d5385679c Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 24 Mar 2017 12:49:56 -0400 Subject: Add notification button and db column --- Project-Unite/Models/IdentityModels.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Project-Unite/Models/IdentityModels.cs') 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 Notifications { get; set; } public DbSet Follows { get; set; } public DbSet UserPosts { get; set; } public DbSet ForumPostEdits { get; set; } -- cgit v1.2.3