public async Task <IActionResult> AssignUsersToAccount([FromBody] AssignUsersToAccount.Request request) { request.AccountId = AccountId.GetValueOrDefault(); request.ActionBy = UserId.GetValueOrDefault(); var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> AddGroup([FromBody] CreateGroup.Request request) { request.AccountId = AccountId.GetValueOrDefault(); request.ActionBy = UserId.GetValueOrDefault(); var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> UpdateTeam([FromBody] UpdateTeam.Request request, Guid id) { request.Id = id; request.AccountId = AccountId.GetValueOrDefault(); request.ActionBy = UserId.GetValueOrDefault(); var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> GetPlayers() { var query = new GetPlayers.Query { AccountId = AccountId.GetValueOrDefault() }; var result = await Mediator.Send(query); return(Ok(result)); }
public async Task <IActionResult> AssignPlayersToTeam([FromBody] AssignPlayersToTeam.Request request, Guid teamId) { request.AccountId = AccountId.GetValueOrDefault(); request.ActionBy = UserId.GetValueOrDefault(); request.TeamId = teamId; var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> AddTournamentRounds([FromBody] CreateTournamentRound.Request request, Guid tournamentId) { request.TournamentId = tournamentId; request.AccountId = AccountId.GetValueOrDefault(); request.ActionBy = UserId.GetValueOrDefault(); var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> UpdateTournamentPrize([FromBody] UpdateTournamentPrize.Request request, Guid tournamentId, Guid prizeId) { request.Id = prizeId; request.TournamentId = tournamentId; request.AccountId = AccountId.GetValueOrDefault(); request.ActionBy = UserId.GetValueOrDefault(); var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> GetPlayersNotInTeam(Guid teamId) { var query = new GetPlayersNotInTeam.Query { AccountId = AccountId.GetValueOrDefault(), TeamId = teamId }; var result = await Mediator.Send(query); return(Ok(result)); }
public async Task <IActionResult> GetTournamentRounds(Guid tournamentId) { var query = new GetTournamentRounds.Query { AccountId = AccountId.GetValueOrDefault(), TournamentId = tournamentId }; var result = await Mediator.Send(query); return(Ok(result)); }
public async Task <IActionResult> GetGroup(Guid id) { var query = new GetGroupById.Query { Id = id, AccountId = AccountId.GetValueOrDefault() }; var result = await Mediator.Send(query); return(Ok(result)); }
public async Task <IActionResult> RemoveUserFromAccount(Guid userId) { var request = new RemoveUserFromAccount.Request { UserId = userId, AccountId = AccountId.GetValueOrDefault(), ActionBy = UserId.GetValueOrDefault(), }; var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> DeleteTournamentRounds(Guid tournamentId) { var request = new DeleteTournamentRound.Request { TournamentId = tournamentId, AccountId = AccountId.GetValueOrDefault(), ActionBy = UserId.GetValueOrDefault() }; var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> AddTournamentTeamGroups(Guid tournamentId) { var request = new AddTournamentTeamsToGroups.Request { TournamentId = tournamentId, AccountId = AccountId.GetValueOrDefault(), ActionBy = UserId.GetValueOrDefault() }; var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> DeleteGroup(Guid id) { var request = new DeleteGroup.Request { Id = id, AccountId = AccountId.GetValueOrDefault(), ActionBy = UserId.GetValueOrDefault(), }; var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <IActionResult> GetTournamentPrize(Guid id, Guid tournamentId) { var query = new GetTournamentPrizeById.Query { Id = id, TournamentId = tournamentId, AccountId = AccountId.GetValueOrDefault() }; var result = await Mediator.Send(query); return(Ok(result)); }
public async Task <IActionResult> RemovePlayerFromTeam(Guid teamId, Guid playerId) { var request = new RemovePlayerFromTeam.Request { AccountId = AccountId.GetValueOrDefault(), ActionBy = UserId.GetValueOrDefault(), TeamId = teamId, PlayerId = playerId }; var result = await Mediator.Send(request); return(Respond(result)); }
public async Task <Guid> GetUserAccountId() { if (_userAccountId != default(Guid)) { return(_userAccountId); } if (UserId == null) { throw new Exception("No user available on this request, ensure that the user is authorized"); } var userAccount = await Mediator.Send(new GetUserAccount.Query { AccountId = AccountId.GetValueOrDefault(), UserId = UserId.GetValueOrDefault() }); if (userAccount == null) { throw new Exception("No user account available on this request, ensure that the user is authorized and that the account scope is correct via the AccountId header."); } if (userAccount.IsDeleted) { throw new Exception("User has been marked inactive with this account. Re-activate user in order to access this account."); } AccountId = userAccount.AccountId; //if (userAccount.IsPending) //{ // await Mediator.Send(new ConfirmPendingUser.Command // { // AccountId = userAccount.AccountId, // UserId = userAccount.UserId, // }); //} return(_userAccountId = userAccount.Id); }