Example #1
0
        public static CatégorieDeCatalogue SansDate(Catégorie catégorie)
        {
            CatégorieDeCatalogue catégorieDeCatalogue = new CatégorieDeCatalogue(catégorie.Id);

            Catégorie.CopieData(catégorie, catégorieDeCatalogue);
            return(catégorieDeCatalogue);
        }
Example #2
0
        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());
        }
Example #3
0
        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());
        }
Example #4
0
        /// <summary>
        /// Retrouve l'état d'une catégorie à une date passée.
        /// </summary>
        /// <param name="archives">archives d'une catégorie</param>
        /// <param name="date">date d'une fin de modification de catalogue passée</param>
        /// <returns></returns>
        public static CatégorieDeCatalogue ALaDate(IEnumerable <ArchiveCatégorie> archives, DateTime date)
        {
            ArchiveCatégorie[]   archivesAvantDate    = archives.Where(a => a.Date < date).OrderBy(a => a.Date).ToArray();
            CatégorieDeCatalogue catégorieDeCatalogue = new CatégorieDeCatalogue(archivesAvantDate.First().Id)
            {
                Date = date
            };

            foreach (ArchiveCatégorie archive in archivesAvantDate)
            {
                Catégorie.CopieDataSiPasNull(archive, catégorieDeCatalogue);
            }
            return(catégorieDeCatalogue);
        }