public async Task <ActionResult <WebApiResponse> > AddRole(long userId, [FromBody] UserRoleDTO role) { if (!CheckRoleIsAuthorized(role.Role)) { throw new WebApiException(System.Net.HttpStatusCode.BadRequest, $"The role '{role.Role}' is not authorized in aws cognito groups, see configuration"); } User user = await _crudComponent.FirstByIdAsync(userId); await _cognitoUserGroups.AddUserToGroup(user.Username, role.Role); return(new WebApiResponse().Success()); }
private async Task <Roulette> GetRoulette(long id) { _rouletteCrudController.AppDbContext = AppDbContext; return(await _rouletteCrudController.FirstByIdAsync(id)); }