mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 11:21:47 -05:00
fix join and leave group
This commit is contained in:
parent
5785c29e95
commit
e013a6e4bf
1 changed files with 4 additions and 2 deletions
|
@ -86,7 +86,8 @@ public ActionResult CreateGroup(GroupViewModel model)
|
||||||
public ActionResult JoinGroup(string id)
|
public ActionResult JoinGroup(string id)
|
||||||
{
|
{
|
||||||
var db = new ApplicationDbContext();
|
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);
|
var group = db.Groups.FirstOrDefault(x => x.Id == id);
|
||||||
if (group == null)
|
if (group == null)
|
||||||
return new HttpStatusCodeResult(404);
|
return new HttpStatusCodeResult(404);
|
||||||
|
@ -99,7 +100,8 @@ public ActionResult JoinGroup(string id)
|
||||||
public ActionResult LeaveGroup()
|
public ActionResult LeaveGroup()
|
||||||
{
|
{
|
||||||
var db = new ApplicationDbContext();
|
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);
|
var group = db.Groups.FirstOrDefault(x => x.Id == user.GroupId);
|
||||||
if (group == null)
|
if (group == null)
|
||||||
return new HttpStatusCodeResult(404);
|
return new HttpStatusCodeResult(404);
|
||||||
|
|
Loading…
Reference in a new issue