Ejemplo n.º 1
0
        public async Task <GetxDatagramsResponse> Handle(GetxDatagramsRequest request, CancellationToken cancellationToken)
        {
            var datagrams = await _datagramRepository.GetDatagrams(cancellationToken).ConfigureAwait(false);

            var lastx = datagrams.OrderBy(datagram => datagram.timeStamp).Reverse().Take(request.amount);

            return(new GetxDatagramsResponse(lastx.ToList()));
        }
        public async Task <GetLastDatagramResponse> Handle(GetLastDatagramRequest request, CancellationToken cancellationToken)
        {
            var datagrams = await _datagramRepository.GetDatagrams(cancellationToken).ConfigureAwait(false);


            List <FullDatagram> sortedDatagrams = datagrams.OrderBy(datagram => datagram.timeStamp).Reverse().ToList();

            return(new GetLastDatagramResponse(sortedDatagrams[0]));
        }