コード例 #1
0
        public static async Task <TemperatureModel> PostTemperature(TemperatureModel temperatureModel)
        {
            var jsonObject  = JsonConvert.SerializeObject(temperatureModel);
            var httpContent = new StringContent(jsonObject, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync("api/Data", httpContent);

            if (response.IsSuccessStatusCode)
            {
                var result = await response.Content.ReadAsStringAsync();

                var temperatureObject = JsonConvert.DeserializeObject <TemperatureModel>(result);
                return(temperatureObject);
            }
            return(null);
        }
コード例 #2
0
        static TemperatureModel DeleteTemperatures(int id)
        {
            var temperatureModel = new TemperatureModel();

            return(temperatureModel);
        }