public async Task <GarmentAvalComponentsListViewModel> Handle(GetAllGarmentAvalComponentsQuery request, CancellationToken cancellationToken)
        {
            var Query = _garmentAvalComponentRepository.ReadList(request.order, request.keyword, request.filter);

            int count = Query.Count();

            Query = Query.Skip((request.page - 1) * request.size).Take(request.size);

            List <GarmentAvalComponentDto> garmentAvalComponentDtos = _garmentAvalComponentRepository.Find(Query)
                                                                      .Select(s => new GarmentAvalComponentDto(s))
                                                                      .ToList();

            var garmentAvalComponentIds = garmentAvalComponentDtos.Select(s => s.Id).ToHashSet();

            var itemQuantity = _garmentAvalComponentItemRepository.Query
                               .Where(w => garmentAvalComponentIds.Contains(w.AvalComponentId))
                               .Select(s => new { s.AvalComponentId, s.Quantity })
                               .ToList();

            Parallel.ForEach(garmentAvalComponentDtos, dto =>
            {
                dto.Quantities = itemQuantity.Where(w => w.AvalComponentId == dto.Id).Sum(s => s.Quantity);
            });

            await Task.Yield();

            return(new GarmentAvalComponentsListViewModel
            {
                count = count,
                GarmentAvalComponents = garmentAvalComponentDtos
            });
        }
        public async Task <GarmentAvalComponentViewModel> Handle(GetGarmentAvalComponentQuery request, CancellationToken cancellationToken)
        {
            var data = _garmentAvalComponentRepository.Find(f => f.Identity == request.Identity)
                       .Select(s => new GarmentAvalComponentViewModel(s))
                       .Single();

            data.Items = _garmentAvalComponentItemRepository.Find(f => f.AvalComponentId == request.Identity)
                         .OrderBy(o => o.SizeName)
                         .Select(s => new GarmentAvalComponentItemDto(s))
                         .ToList();

            await Task.Yield();

            return(data);
        }