Пример #1
0
 private SerialFilter GetFilter(SerialQuery request)
 {
     return(new SerialFilter()
     {
         Id = request.Id.Value,
         Serial = request.Serial
     });
 }
Пример #2
0
        public async Task <PaginatedList <SerialResult> > Handle(SerialQuery request, CancellationToken cancellationToken)
        {
            var filter   = GetFilter(request);
            var seriales = await _serialService.GetSerials(filter);

            int total = await _serialService.GetTotalSerials(filter);

            PaginatedList <SerialResult> result = CreateResultResponse(request, seriales);

            result.Total = total;
            return(result);
        }
Пример #3
0
        private PaginatedList <SerialResult> CreateResultResponse(SerialQuery request, List <Serials> result)
        {
            var serialsResult = new List <SerialResult>();
            var filteredList  = result;

            foreach (var serial in filteredList)
            {
                var serialResult = new SerialResult()
                {
                    Id              = serial.Id,
                    Serial          = serial.Serial,
                    ArrivalSerials  = serial.ArrivalSerials,
                    DispatchSerials = serial.DispatchSerials,
                    InvoiceSerials  = serial.InvoiceSerials,
                    RequestSerials  = serial.RequestSerials
                };

                serialsResult.Add(serialResult);
            }

            return(new PaginatedList <SerialResult>(serialsResult));
        }