public void CreateGroup(Group grp, ApplicationUser user) { grp = context.Groups.Add(grp); GroupMembership grpMem = new GroupMembership() { GroupID = grp.ID, UserID = user.Id, Rank = 1 }; context.GroupMemberships.Add(grpMem); context.SaveChanges(); }
public bool JoinGroup(int grpID, string userID) { if (context.Groups.Find(grpID) == null) { return false; } else { GroupMembership grpMem = new GroupMembership() { GroupID = grpID, UserID = userID, Rank = 2 }; GroupMembership grpMem2 = context.GroupMemberships.Add(grpMem); context.SaveChanges(); return true; } }