示例#1
0
        public async Task <SubvaultResponseModel> Get(string orgId, string id)
        {
            var subvault = await _subvaultRepository.GetByIdAsync(new Guid(id));

            if (subvault == null || !_currentContext.OrganizationAdmin(subvault.OrganizationId))
            {
                throw new NotFoundException();
            }

            return(new SubvaultResponseModel(subvault));
        }
        public async Task <ListResponseModel <SubvaultUserResponseModel> > GetBySubvault(string orgId, string subvaultId)
        {
            var subvaultIdGuid = new Guid(subvaultId);
            var subvault       = await _subvaultRepository.GetByIdAsync(subvaultIdGuid);

            if (subvault == null || !_currentContext.OrganizationAdmin(subvault.OrganizationId))
            {
                throw new NotFoundException();
            }

            var subvaultUsers = await _subvaultUserRepository.GetManyDetailsBySubvaultIdAsync(subvaultIdGuid);

            var responses = subvaultUsers.Select(s => new SubvaultUserResponseModel(s));

            return(new ListResponseModel <SubvaultUserResponseModel>(responses));
        }