From e4a501c0260458e99be9ac557df380a1aaf9e6b2 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 18 May 2017 16:33:27 -0400 Subject: notifications page --- Project-Unite/Controllers/ManageController.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Project-Unite/Controllers/ManageController.cs') 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(); -- cgit v1.2.3