コード例 #1
0
        public async Task <ProviderOrganizationResponseModel> Post(Guid providerId, [FromBody] OrganizationCreateRequestModel model)
        {
            var user = await _userService.GetUserByPrincipalAsync(User);

            if (user == null)
            {
                throw new UnauthorizedAccessException();
            }

            if (!_currentContext.ManageProviderOrganizations(providerId))
            {
                throw new NotFoundException();
            }

            var organizationSignup = model.ToOrganizationSignup(user);
            var result             = await _providerService.CreateOrganizationAsync(providerId, organizationSignup, user);

            return(new ProviderOrganizationResponseModel(result));
        }