Example #1
0
        public async Task <int> HandleAsync(GetRegisteredVaccineCountQuery message, CancellationToken cancellationToken)
        {
            var allManufacturers = await _entityRepositoryFactory.Create <Manufacturer>()
                                   .Query()
                                   .FetchMany(m => m.TradeMarks)
                                   .Where(m => m.HasMedicalLicense)
                                   .ToListAsync(cancellationToken);

            return(allManufacturers.SelectMany(m => m.TradeMarks)
                   .Count(tm => tm.IsActiveVaccine()));
        }