Beispiel #1
0
        public async Task <ItemDetailsDTO> GetDetails(int id)
        {
            using (var httpClient = new HttpClient())
            {
                var uri = new Uri(RestHelper.ApiUrl($"{ItemsApiEndpoint}/{id}/details"));

                var response = await httpClient.GetStringAsync(uri);

                return(JsonConvert.DeserializeObject <ItemDetailsDTO>(response));
            }
        }
Beispiel #2
0
        public async Task <ICollection <ItemDTO> > GetAll()
        {
            using (var httpClient = new HttpClient())
            {
                var uri = new Uri(RestHelper.ApiUrl(ItemsApiEndpoint));

                var response = await httpClient.GetStringAsync(uri);

                return(JsonConvert.DeserializeObject <ICollection <ItemDTO> >(response));
            }
        }