public async Task <IEnumerable <SearchCounterStats> > GetCounterStats()
        {
            var locations = await _locationOperationRepository.GetAllAsync();

            var ops = await _operationRepository.GetAllAsync();

            List <SearchCounterStats> stats = new List <SearchCounterStats>();

            stats.Add(new SearchCounterStats()
            {
                Id    = 1,
                Name  = "Service-uri",
                Count = locations
                        .Where(e => ops.Where(z => z.ServiceOperationType.ServiceOperationTypeId < 15)
                               .Any(z => z.ServiceOperationId == e.ServiceOperationId) == true)
                        .Select(e => e.ServiceLocationId).Distinct().Count()
            });

            stats.Add(new SearchCounterStats()
            {
                Id    = 2,
                Name  = "Vulcanizari",
                Count = locations.Where(e => ops.Where(z => z.ServiceOperationType.ServiceOperationTypeId == 16).Any(z => z.ServiceOperationId == e.ServiceOperationId) == true).Select(e => e.ServiceLocationId).Distinct().Count()
            });

            stats.Add(new SearchCounterStats()
            {
                Id    = 3,
                Name  = "Spalatorii",
                Count = locations.Where(e => ops.Where(z => z.ServiceOperationType.ServiceOperationTypeId == 15).Any(z => z.ServiceOperationId == e.ServiceOperationId) == true).Select(e => e.ServiceLocationId).Distinct().Count()
            });

            return(stats);
        }
Esempio n. 2
0
 public async Task <IEnumerable <ServiceOperationViewModel> > GetServiceOperations()
 {
     return(_mapper.Map <IEnumerable <ServiceOperation>, IEnumerable <ServiceOperationViewModel> >(await _serviceOperationRepository.GetAllAsync()));
 }