Ejemplo n.º 1
0
 public DataController()
 {
     this.url         = "https://localhost:5002/api/values";
     this.apiReq      = new ApiRequestModel();
     this.validation  = new ValidationModel();
     this.bookerModel = new BookerModel();
 }
Ejemplo n.º 2
0
        public TOutput Get <TOutput>(IApiRequestModel request)
        {
            var response = _httpClient.GetAsync($"{request.Endpoint}?access_key=a8ece45e2d36555359d8a61545886b1b").Result;

            if (response.IsSuccessStatusCode)
            {
                return(response.Content.ReadAsAsync <TOutput>().Result);
            }
            else
            {
                throw new Exception($"failed to call endpoint: {request.Endpoint}");
            }
        }