public ActionResult AddStop(AddStopViewModel addStop) { if (!this.ModelState.IsValid) { return View("AddStop", addStop); } string name = addStop.Name; IEnumerable<TmpAddRouteStopViewModel> routesList = this.ConnectStopsWithRoutes(addStop); foreach (TmpAddRouteStopViewModel intersectObect in routesList) { var intermediateToFineIntersects = new List<Route> { intersectObect.Route }; var intermidStop = new Stop { Name = name, StopGeography = intersectObect.StopPoint, StopType = int.Parse(addStop.Selected), Routes = intermediateToFineIntersects }; this.stopRepository.Add(intermidStop); } this.stopRepository.Save(); return this.RedirectToAction("AddStop"); }
/// <summary> /// Gets the points from stops. /// </summary> /// <param name="stop">The route.</param> /// <returns>Points of stops to paint this stops on map</returns> private MapPoint GetPointsFromStops(Stop stop) { return stop.Points = new MapPoint((double)stop.StopGeography.Long, (double)stop.StopGeography.Lat); }