public async Task <IActionResult> SwitchTeam(int teamId) { userSessionHelper.SetTeamId(teamId); await userAccountManager.SetDefaultTeam(userSessionHelper.UserId, teamId); return(Json("Changed")); }
public async Task <IActionResult> SwitchTeam(int teamId) { _userSessionHelper.SetTeamId(teamId); await _userAccountManager.SetDefaultTeam(_userSessionHelper.UserId, teamId); tc.TrackEvent("Switching Team"); return(Json("Changed")); }
public async Task <JsonResult> SwitchTeam(int id) { if (!teamManager.DoesCurrentUserBelongsToTeam(this.userSessionHelper.UserId, id)) { return(Json(new { Status = "Error", Message = "You do not belong to this team!" })); } userSessionHelper.SetTeamId(id); await userAccountManager.SetDefaultTeam(userSessionHelper.UserId, id); return(Json(new { Status = "Success" })); }
public async Task <JsonResult> SwitchTeam(int id) { try { if (!_teamManager.DoesCurrentUserBelongsToTeam(this._userSessionHelper.UserId, id)) { tc.TrackEvent("Trying to access some one else's team"); return(Json(new { Status = "Error", Message = "You do not belong to this team!" })); } _userSessionHelper.SetTeamId(id); await _userAccountManager.SetDefaultTeam(_userSessionHelper.UserId, id); return(Json(new { Status = "Success" })); } catch (Exception ex) { tc.TrackException(ex); return(Json(new { Status = "Error", Message = "Error processing your request" })); } }