Пример #1
0
 public JsonResult GetConnectionStatus(ToolkitInputModel toolkitInputModel)
 {
     restClientController = new RestClientController(toolkitInputModel.EndPoint, toolkitInputModel.HttpMethod);
     restClientController.MakeRequest();
     toolkitViewModel.ConnectionStatus = (restClientController.GetResponse() == "{}") ? true : false;
     return(Json(toolkitViewModel, JsonRequestBehavior.AllowGet));
 }
Пример #2
0
        public JsonResult Refresh(StandardTradeToolInputModel standardTradeToolInputModel)
        {
            restClientController = new RestClientController(standardTradeToolInputModel.EndPoint, standardTradeToolInputModel.HttpMethod);
            restClientController.MakeRequest();
            //ECurrencyPair currencyPair = new ECurrencyPair();
            //decimal tickerPrice = 0.0M;

            //exchangeDataModel.CurrencyPair = currencyPair;
            //exchangeDataModel.TickerPrice = tickerPrice;
            //InitiateTrade();
            string        rawTicker    = restClientController.GetResponse();
            ECurrencyPair currencyPair = ECurrencyPair.NOT_SELECTED;
            decimal       amount       = 0.0m;

            ExchangeController.ProcessRawData(rawTicker, ref currencyPair, ref amount);
            standardTradeToolViewModel.CurrencyPair = currencyPair.ToString();
            standardTradeToolViewModel.Amount       = amount;
            return(Json(standardTradeToolViewModel, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public static Test GetRESTResponse(Models.RESTRequest request, User user)
        {
            var restClient = new RestClientController()
            {
                EndPoint    = request.EndPoint,
                Method      = request.Method,
                PostData    = request.PostData,
                ContentType = request.ContentType
            };
            var response   = restClient.ProcessRequest();
            var resultJson = JsonFormater.FormatJson(response.Item2);
            var testcase   = new Test
            {
                Request        = request.PostData,
                Response       = resultJson,
                ProcessingTime = response.Item1,
                UserId         = user.Id,
                Uri            = request.EndPoint,
                ServiceName    = user.ServiceName
            };

            return(testcase);
        }