diff options
Diffstat (limited to 'Project-Unite/Models')
| -rw-r--r-- | Project-Unite/Models/IdentityModels.cs | 18 | ||||
| -rw-r--r-- | Project-Unite/Models/Notification.cs | 17 |
2 files changed, 35 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; } diff --git a/Project-Unite/Models/Notification.cs b/Project-Unite/Models/Notification.cs new file mode 100644 index 0000000..dd13e5b --- /dev/null +++ b/Project-Unite/Models/Notification.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Project_Unite.Models +{ + public class Notification + { + public string Id { get; set; } + public string UserId { get; set; } + public string Discriminator { get; set; } + public DateTime Timestamp { get; set; } + public bool IsRead { get; set; } + + } +}
\ No newline at end of file |
