// POST api/location public void Post(string lat, string @long) { LocationRepository rep = new LocationRepository(); DateTime now = DateTime.UtcNow; Location location = new Location("1", now) { Latitude = double.Parse(lat), Longitude = double.Parse(@long) }; rep.Add(location); }
public void Add(Location location) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); TableServiceContext serviceContext = tableClient.GetDataServiceContext(); // Add the new customer to the people table serviceContext.AddObject("locations", location); // Submit the operation to the table service serviceContext.SaveChanges(); }