public object Get(ManualRideLinqRequest request) { var order = _orderDao.GetManualRideLinqById(request.OrderId); return(new ManualRideLinqResponse { Data = order, IsSuccessful = true }); }
public object Delete(ManualRideLinqRequest request) { var order = _orderDao.GetManualRideLinqById(request.OrderId); if (order == null) { return(new HttpResult(HttpStatusCode.NotFound)); } try { var response = _cmtMobileServiceClient.Delete <CmtUnpairingResponse>(string.Format("init/pairing/{0}", order.PairingToken)); // Wait for trip to be updated _cmtTripInfoServiceHelper.WaitForRideLinqUnpaired(order.PairingToken, response.TimeoutSeconds); _commandBus.Send(new UnpairOrderForManualRideLinq { OrderId = request.OrderId }); } catch (WebServiceException ex) { _logger.LogMessage(string.Format("A WebServiceException occured while trying to manually unpair with CMT for OrderId: {0} with pairing token: {1}", request.OrderId, order.PairingToken)); _logger.LogError(ex); string errorResponse = null; if (ex.ResponseBody != null) { errorResponse = ex.ResponseBody; _logger.LogMessage("Error Response: {0}", errorResponse); } throw new HttpError(HttpStatusCode.InternalServerError, errorResponse ?? ex.Message); } catch (Exception ex) { _logger.LogMessage(string.Format("An error occured while trying to manually unpair with CMT for OrderId: {0} with pairing token: {1}", request.OrderId, order.PairingToken)); _logger.LogError(ex); throw new HttpError(HttpStatusCode.InternalServerError, ex.Message); } return(new HttpResult(HttpStatusCode.OK)); }