Exemplo n.º 1
0
        public async Task Execute(GetOrdersInput input)
        {
            if (input == null)
            {
                _outputHandler.Error("Input is null.");
                return;
            }
            var orders = await _clientRepository.GetSentOrders(input.SenderId);

            List <CreateOrdersOutput> outputOrders = new List <CreateOrdersOutput>();
            CreateOrdersOutput        tempOutput;

            foreach (var o in orders)
            {
                var sender = _clientRepository.GetById(o.SenderId);
                var parcel = _parcelRepository.GetParcelById(o.ParcelId);
                tempOutput = new CreateOrdersOutput(o.Id, sender.Result, o.RecipientName, o.RecipientSurname, parcel.Result, o.Status);
                outputOrders.Add(tempOutput);
            }
            _outputHandler.Standard(outputOrders);
        }
 public async Task <Parcel> GetParcelById(string id)
 {
     return(await _parcelRepository.GetParcelById(id));
 }