public ActionResult Edit(Station station) { if (!ModelState.IsValid) { return View("Edit", station); } stationsRepository.Save(station); TempData["notice"] = "Estacion actualizada correctamente"; return RedirectToAction("Index"); }
public static void CurrentClosestStation(IQueryable<Station> stations, IStationHolder holder, TaskScheduler scheduler, Geolocator geolocator) { geolocator.DesiredAccuracy = 50; var locator = geolocator; locator.GetPositionAsync (10000).ContinueWith (t => { if(t.Status == TaskStatus.RanToCompletion){ var currentStation = new Station{Latitude = t.Result.Latitude, Longitude = t.Result.Longitude}; holder.Station = currentStation.GetClosestStation(stations); }else{ var currentStation = Station.NotFoundStation(); holder.Station = currentStation; } }, scheduler); }
private static double SortableApproximateDistance(Station source, Station target) { return Math.Pow (target.Latitude - source.Latitude, 2) + Math.Pow (target.Longitude - source.Longitude, 2); }
public void Save(Station station) { database.GetCollection<Station>("stations").Save(station); }
public void Save(Station station) { }