diff --git a/Project-Unite/Controllers/ManageController.cs b/Project-Unite/Controllers/ManageController.cs index c3d9921..d80cbcb 100644 --- a/Project-Unite/Controllers/ManageController.cs +++ b/Project-Unite/Controllers/ManageController.cs @@ -111,6 +111,19 @@ namespace Project_Unite.Controllers } } + public ActionResult MarkAllRead() + { + var db = new ApplicationDbContext(); + string uid = User.Identity.GetUserId(); + var unread = db.Notifications.Where(x => x.IsRead == false && x.UserId == uid); + foreach(var u in unread.ToArray()) + { + u.IsRead = true; + } + db.SaveChanges(); + return Redirect(Url.Action("Index", "Manage") + "#t_notifications"); + } + public ActionResult Notification(string id, string url) { var db = new ApplicationDbContext(); diff --git a/Project-Unite/Views/Manage/Index.cshtml b/Project-Unite/Views/Manage/Index.cshtml index 198180f..cff7179 100644 --- a/Project-Unite/Views/Manage/Index.cshtml +++ b/Project-Unite/Views/Manage/Index.cshtml @@ -95,6 +95,38 @@

Send me notifications through email when I'm inactive

Check this option to allow us to email you when you receive a notification and you haven't logged in for a week.

@Html.CheckBoxFor(Model=>Model.EmailOnNotifications) + @{ + var notes = Model.Notifications.Where(x=>x.IsRead==false).OrderByDescending(x=>x.Timestamp); + } +

Unread Notifications

+ @if (notes.Count() > 0) + { +

Below is a list of all unread notifications.

+ + + +
+ Notification +
+ @foreach(var note in notes) + { +
+ @if (!string.IsNullOrWhiteSpace(note.AvatarUrl)) + { + + } +
@note.Title
+

@note.Description

+ Read +
+ } + } + else + { +

You have no notifications.

+ }

Privacy & Security

diff --git a/Project-Unite/Views/Shared/_LoginPartial.cshtml b/Project-Unite/Views/Shared/_LoginPartial.cshtml index 4acf09b..2a92827 100644 --- a/Project-Unite/Views/Shared/_LoginPartial.cshtml +++ b/Project-Unite/Views/Shared/_LoginPartial.cshtml @@ -15,7 +15,7 @@