Пример #1
0
        public async Task <ProviderResponseModel> Setup(Guid id, [FromBody] ProviderSetupRequestModel model)
        {
            if (!_currentContext.ProviderProviderAdmin(id))
            {
                throw new NotFoundException();
            }

            var provider = await _providerRepository.GetByIdAsync(id);

            if (provider == null)
            {
                throw new NotFoundException();
            }

            var userId = _userService.GetProperUserId(User).Value;

            var response =
                await _providerService.CompleteSetupAsync(model.ToProvider(provider), userId, model.Token, model.Key);

            return(new ProviderResponseModel(response));
        }