public async Task <List <Location> > GetLocationData() { LambdaPackage lp = new LambdaPackage(); lp.Function = "getlocations"; string json = JsonConvert.SerializeObject(lp); string raw = await ExecuteDataRequest(json); List <Location> locations = new List <Location>(); locations = JsonConvert.DeserializeObject <List <Location> >(raw); lp.Function = "gettotals"; json = JsonConvert.SerializeObject(lp); raw = await ExecuteDataRequest(json); List <DailyTotal> totals = new List <DailyTotal>(); totals = JsonConvert.DeserializeObject <List <DailyTotal> >(raw); foreach (Location loc in locations) { foreach (DailyTotal total in totals) { if (loc.LocationKey == total.LocationKey) { loc.Totals.Add(total); loc.SortTotals(); } } } return(locations); }
public async Task <List <DailyTotal> > GetTotals() { LambdaPackage lp = new LambdaPackage(); lp.Function = "gettotals"; string json = JsonConvert.SerializeObject(lp); string raw = await ExecuteDataRequest(json); return(JsonConvert.DeserializeObject <List <DailyTotal> >(raw)); }
public async void AddLocation(double latitude, double longitude) { LambdaPackage lp = new LambdaPackage(); lp.Function = "addlocation"; lp.Latitude = latitude; lp.Longitude = longitude; string json = JsonConvert.SerializeObject(lp); string raw = await ExecuteDataRequest(json); }