public async Task <List <WeightVolume> > GetAsync()
        {
            var model    = new List <WeightVolume>();
            var response = await ClientService.GetByApplicationHeaderDataAsync(ControllerName, "get");

            if (response != null)
            {
                var jsonTask = response.Content.ReadAsStringAsync();
                jsonTask.Wait();
                model = JsonConvert.DeserializeObject <List <WeightVolume> >(jsonTask.Result);
            }

            return(model);
        }
Пример #2
0
        public async Task <List <NewsModel> > GetByLanguage(string languageCode, bool active)
        {
            var model    = new List <NewsModel>();
            var response = await ClientService.GetByApplicationHeaderDataAsync(ControllerName,
                                                                               "get?languageCode=" + languageCode + "&active=" + active);

            if (response != null && response.IsSuccessStatusCode == true && response.StatusCode == HttpStatusCode.OK)
            {
                var jsonTask = response.Content.ReadAsStringAsync();
                jsonTask.Wait();
                model = JsonConvert.DeserializeObject <List <NewsModel> >(jsonTask.Result);
                var executionTime = response.Headers.GetValues(App.Configuration.AppConfig.ExecutionTimeHeader).First();
                if (executionTime != null)
                {
                    if (long.TryParse(executionTime, out long execTime))
                    {
                        ExecutionTime = execTime;
                    }
                }
            }

            return(model);
        }