/// <summary> /// Removes the authenticated user from the team specified by the given ID. /// </summary> /// <param name="teamID">ID of the team to remove the player from.</param> /// <returns>Success message of the removal.</returns> public ActionResult AJAX_LeaveTeam(long teamID) { // Make sure the user is authenticated string result = "Request not authenticated."; if (Request.IsAuthenticated) { // Get the person id for the user currently logged in DBAccessor dba = new DBAccessor(); long userID = dba.GetPersonID(User.Identity.Name); // Remove the player from the team if (dba.RemovePlayerFromTeam(userID, teamID)) { result = "Succesfully removed player from the team."; } else { result = "Failure to remove player from team."; } } // Return the success message of the removal return Json( new { message = result }, JsonRequestBehavior.AllowGet ); }