public async Task <IReadOnlyCollection <LicenseDto> > GetAllLicensesAsync(LicenseSSFP options) { var licenses = _paraContext.Licenses .AsNoTracking() .FilterLicenseBy(options.FilterBy, options.NumberLicence, options.NameLicense) .SearchLicenseBy(options.SearchBy, options.NameLicense, options.NumberLicence) .SortLicenseBy(options.SortBy) .Select(l => new LicenseDto { LicenseID = l.ID, Title = l.Title, LevelDifficultyIndex = l.Level.DifficultyIndex }); return(await licenses.ToListAsync()); }
public async Task <ActionResult <IReadOnlyCollection <LicenseDto> > > GetAllLicenses([FromQuery] LicenseSSFP options) { var licenses = await _licenseService.GetAllLicensesAsync(options); if (licenses == null) { return(NotFound("Collection was empty :O")); } return(Ok(licenses)); }