Exemple #1
0
        public async Task <ProviderResponseModel> Put(Guid id, [FromBody] ProviderUpdateRequestModel model)
        {
            if (!_currentContext.ProviderProviderAdmin(id))
            {
                throw new NotFoundException();
            }

            var provider = await _providerRepository.GetByIdAsync(id);

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

            await _providerService.UpdateAsync(model.ToProvider(provider, _globalSettings));

            return(new ProviderResponseModel(provider));
        }
Exemple #2
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));
        }