public async Task <LicenseDto> GetAsync(Guid id) { var license = await _licenseRepository.GetAsync(id); if (license == null) { throw new ServiceException("license_not_found", $"License: '{id}' was not found. "); } return(_mapper.Map <License, LicenseDto>(license)); }
public async Task <SofaLicense> GetLicense(int licenseId, long userId) { var license = await _licenseRepo.GetAsync(licenseId); if (license == null) { throw new System.UnauthorizedAccessException("Unable process request"); } if (!await IsUserReadAuthorized(license, userId)) { throw new System.UnauthorizedAccessException("Unauthorized"); } return(license); }
public async Task <IEnumerable <SofaLicense> > GetLicenses() { return(await _licenseRepo.GetAsync()); }