public async Task <List <CatégorieDeCatalogue> > CatégoriesDeCatalogue(uint idSite) { List <Catégorie> catégories = await _context.Catégorie .Where(c => c.SiteId == idSite) .ToListAsync(); return(catégories.Select(c => CatégorieDeCatalogue.SansDate(c)).ToList()); }
public async Task <List <CatégorieDeCatalogue> > CatégoriesDeCatalogueDesDisponibles(uint idSite) { List <Catégorie> catégories = await _context.Catégorie .Where(c => c.SiteId == idSite) .Include(c => c.Produits) .Where(c => c.Produits.Where(p => p.Disponible).Any()) .ToListAsync(); return(catégories.Select(c => CatégorieDeCatalogue.SansDate(c)).ToList()); }