Ejemplo n.º 1
0
        public async Task <List <Entities.SmartEnergyMeter> > SmartEnergyMeterList()
        {
            List <SmartEnergyMeter.Entities.SmartEnergyMeter> smartEmList = new List <SmartEnergyMeter.Entities.SmartEnergyMeter>();
            HttpResponseMessage response = await client.GetAsync(url + "smartem/get");

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

                var smartData = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SmartEnergyMeter.Entities.SmartEnergyMeter> >(data);
                if (smartData != null)
                {
                    foreach (SmartEnergyMeter.Entities.SmartEnergyMeter t in smartData)
                    {
                        SmartEnergyMeter.Entities.SmartEnergyMeter temp = new SmartEnergyMeter.Entities.SmartEnergyMeter();
                        temp.Id         = t.Id;
                        temp.CustomerId = t.CustomerId;
                        temp.TariffType = t.TariffType;

                        smartEmList.Add(temp);
                    }
                }
            }

            return(smartEmList);
        }
Ejemplo n.º 2
0
 public bool Post([FromBody] SmartEnergyMeter.Entities.SmartEnergyMeter smartEM)
 {
     return(repository.InsertSmartEnergyMeter(smartEM));
 }