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 @@
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); + } +Below is a list of all unread notifications.
+ + + +@note.Description
+ Read +You have no notifications.
+ }