コード例 #1
0
ファイル: UsersController.cs プロジェクト: ybarrantes/casino
        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());
        }
コード例 #2
0
        private async Task <Roulette> GetRoulette(long id)
        {
            _rouletteCrudController.AppDbContext = AppDbContext;

            return(await _rouletteCrudController.FirstByIdAsync(id));
        }