Beispiel #1
0
        private static void readFitnessLocations()
        {
            string[] locations = File.ReadAllLines(@"C:\AppFiles\fitnesscoords.txt");

            for (int i = 0; i < locations.Length; i++)
            {
                FitnessLocation loc  = new FitnessLocation();
                string[]        temp = locations[i].Split(';');
                loc.Name      = temp[0];
                loc.SubTitle  = temp[1];
                loc.Latitude  = double.Parse(temp[2]);
                loc.Longitude = double.Parse(temp[3]);
                LocationAPI.AddFitnessLocation(loc);
            }
        }
 public IHttpActionResult PostNewLocation([FromBody] FitnessLocation newLocation)
 {
     if (null != newLocation &&
         null != newLocation.Name &&
         null != newLocation.Address &&
         null != newLocation.Focus)
     {
         newLocation.FitnessLocationId = Guid.NewGuid();
         db.FitnessLocations.Add(newLocation);
         db.SaveChanges();
         return(Ok());
     }
     else
     {
         return(Unauthorized());
     }
 }