public async Task <IResponse <OrderResult> > RegisterPostOrder(DeliveryOrderDTO deliveryOrderDTO) { var result = new Response <OrderResult>(); try { var registerOrderResult = await AloPeikProvider.RegisterOrder(deliveryOrderDTO.Addresses.FirstOrDefault(x => x.Type == "origin"), deliveryOrderDTO.Addresses.FirstOrDefault(x => x.Type == "destination"), false, false, deliveryOrderDTO.ExtraParams); result.Result = new OrderResult { OrderId = registerOrderResult.Id, OrderToken = registerOrderResult.Order_Token, OrderDiscount = registerOrderResult.Order_Discount, Price = registerOrderResult.Final_Price, //ExtraParams = registerOrderResult.Extra_Param, PayAtDestination = registerOrderResult.Pay_At_Dest, Cashed = registerOrderResult.Cashed, Delay = registerOrderResult.Delay, Duration = registerOrderResult.Duration, Distance = registerOrderResult.Distance, Has_Return = registerOrderResult.Has_Return, Addresses = registerOrderResult.Addresses }; result.IsSuccessful = true; result.Message = ServiceMessage.Success; return(result); } catch (Exception e) { FileLoger.Error(e); result.Message = ServiceMessage.Exception; return(result); } }
public IHttpActionResult GetAllDO(string supplierid) { List <DeliveryOrder> deliveryOrders = _context.DeliveryOrder.Where(m => m.SupplierId == supplierid && m.Status == "BILLED").ToList(); if (deliveryOrders == null) { return(NotFound()); } List <DeliveryOrderDTO> viewModels = new List <DeliveryOrderDTO>(); for (int i = 0; i < deliveryOrders.Count; i++) { DeliveryOrderDTO viewModel = new DeliveryOrderDTO(); viewModel.DelOrderId = deliveryOrders[i].DelOrderId; viewModel.DelOrderNo = deliveryOrders[i].DelOrderNo; viewModels.Add(viewModel); } return(Ok(viewModels)); }
public async Task <IActionResult> Post([FromBody] DeliveryOrderDTO deliveryOrderDTO) => Ok(await _deliveryService.RegisterPostOrder(deliveryOrderDTO));