public static Route ToRoute(Route_BLL_DTO Route_BLL_DTO, DataModel context) { Route route = new Route(); route.City = ToCity(Route_BLL_DTO.City, context); foreach (Point_BLL_DTO p in Route_BLL_DTO.Points) { route.Points.Add(ToPoint(p, context)); } return(route); }
private void Add_Activity_Click(object sender, RoutedEventArgs e) { Activity_BLL_DTO activity = new Activity_BLL_DTO(); activity.Date = DateBox.SelectedDate.Value; activity.Date = TimeBox.SelectedTime.Value; activity.Type = (Sport_ComboBox.SelectedItem as ActivityType_BLL_DTO); List <Point_BLL_DTO> points = new List <Point_BLL_DTO>(); points.Add(new Point_BLL_DTO() { Latitude = (decimal)map_Page.Get_Start_DragPin.Location.Latitude, Longitude = (decimal)map_Page.Get_Start_DragPin.Location.Longitude }); for (int i = 0; i < map_Page.Get_Other_DragPins.Count; i++) { points.Add(new Point_BLL_DTO() { Latitude = (decimal)map_Page.Get_Other_DragPins[i].Location.Latitude, Longitude = (decimal)map_Page.Get_Other_DragPins[i].Location.Longitude }); } points.Add(new Point_BLL_DTO() { Latitude = (decimal)map_Page.Get_End_DragPin.Location.Latitude, Longitude = (decimal)map_Page.Get_End_DragPin.Location.Longitude }); Route_BLL_DTO route = new Route_BLL_DTO(); route.Points = points.ToArray(); route.City = (CityBox.SelectedItem as City_BLL_DTO); activity.Route = route; activity.Route.City = (CityBox.SelectedItem as City_BLL_DTO); MessageBox.Show(activity.Date.ToString() + " " + activity.Type); _bll.CreateActivity(activity); }