Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var getJsonResponse = (await _requestSender.GetAsync("/api/test/json")).ResultAs <Person>(ContentType.JSON);

            ViewData["getJsonResponse"] = getJsonResponse;

            var getXmlResponse = (await _requestSender.GetAsync("/api/test/xml")).ResultAs <Person>(ContentType.XML);

            ViewData["getXmlResponse"] = getXmlResponse;

            var postAndGetJson = (await _requestSender.PostAsync("/api/test/json", new Person()
            {
                Id = 2, Name = "John"
            }))
                                 .ResultAs <Person>(ContentType.JSON);

            ViewData["postAndGetJson"] = postAndGetJson;

            var postAndGetXml = (await _requestSender.PostAsync("/api/test/xml", new Person()
            {
                Id = 2, Name = "John"
            })).ResultAs <Person>(ContentType.XML);

            ViewData["postAndGetXml"] = postAndGetXml;

            var postFormGetJson = (await _requestSender.PostAsync("/api/test/form", new Person()
            {
                Id = 2, Name = "John"
            }, ContentType.FORM)).ResultAs <Person>();

            ViewData["postFormGetJson"] = postFormGetJson;


            return(View());
        }
Ejemplo n.º 2
0
        public async Task <HistoricalResponse> Daily(HistoricalAny model)
        {
            var @params = ParseFull(model);
            var url     = Navigator.HistoricalDaily;

            return(await RequestSender.GetAsync <HistoricalResponse>(url, @params));
        }
Ejemplo n.º 3
0
 public async Task <HistoricalResponse> Minutly(HistoricalAny model)
 {
     return(await RequestSender.GetAsync <HistoricalResponse>(Navigator.HistoricalMinutly, ParseFull(model)));
 }