diff --git a/Project-Unite/Controllers/GroupsController.cs b/Project-Unite/Controllers/GroupsController.cs index d171d98..55b23b6 100644 --- a/Project-Unite/Controllers/GroupsController.cs +++ b/Project-Unite/Controllers/GroupsController.cs @@ -86,7 +86,8 @@ public ActionResult CreateGroup(GroupViewModel model) public ActionResult JoinGroup(string id) { var db = new ApplicationDbContext(); - var user = db.Users.FirstOrDefault(x => x.Id == User.Identity.GetUserId()); + string UserId = User.Identity.GetUserId(); + var user = db.Users.FirstOrDefault(x => x.Id == UserId); var group = db.Groups.FirstOrDefault(x => x.Id == id); if (group == null) return new HttpStatusCodeResult(404); @@ -99,7 +100,8 @@ public ActionResult JoinGroup(string id) public ActionResult LeaveGroup() { var db = new ApplicationDbContext(); - var user = db.Users.FirstOrDefault(x => x.Id == User.Identity.GetUserId()); + string UserId = User.Identity.GetUserId(); + var user = db.Users.FirstOrDefault(x => x.Id == UserId); var group = db.Groups.FirstOrDefault(x => x.Id == user.GroupId); if (group == null) return new HttpStatusCodeResult(404);