public ActionResult AddPlayerToGroup(int?id, string username) { bool completed = false; int iD = 0; if (id == null) { iD = (int)Session["currentGroupID"]; } else { iD = (int)id; } if (String.IsNullOrEmpty(username)) { completed = groupLogic.AddPlayerToGroup(iD, Session["Username"].ToString()); } else { completed = groupLogic.AddPlayerToGroup(iD, username); } return(completed ? RedirectToAction("GroupDetails", "Group", new{ id = iD }) : RedirectToAction("ViewPublicGroups", "Group", new{ message = "Something went wrong. Please try again later." })); }