public DetailRouteViewModel(TimeTableModel route) { _viewId = Guid.NewGuid(); db = new BusStationContext(); idRoute = route.idRoute; isEdit = false; NameDeparturePlace = route.DeparturePlace; NameArrivalPlace = route.ArrivalPlace; CostRoute = Convert.ToDecimal(route.Cost); timesList = new ObservableCollection <TimeSpan>(); foreach (var item in route.DepartureTime.OrderBy(i => i)) { timesList.Add(item); } selectedTime = timesList[0] == null ? default(TimeSpan) : timesList[0]; stopsList = new ObservableCollection <Stop>(); foreach (var item in route.StopList) { stopsList.Add(new Stop() { Id = item.Id, Name = item.Name, Cost = item.Cost }); } }
public PassengerViewModel() { _viewId = Guid.NewGuid(); db = new BusStationContext(); Fio = ""; DateOfBirth = new DateTime(1980, 1, 1); }
public RolesRepository(BusStationContext busStationContext) { _busStationContext = busStationContext; }
public TimeTableViewModel() { //var db = new BusStationContext(); //Route route = new Route(); startCities = new List <Point>(); endCities = new ObservableCollection <Point>(); endStations = new ObservableCollection <Point>(); trips = new ObservableCollection <TimeTableModel>(); db = new BusStationContext(); foreach (var route in db.Route.ToList().Select(i => new TimeTableModel(i)).ToList()) { trips.Add(route); } var allCities = db.Route.ToList(); foreach (var city in allCities) { startCities.Add(new Point() { Id = city.IdRoute, Name = city.Departure_place, isCity = true }); endCities.Add(new Point() { Id = city.IdRoute, Name = city.Arrival_place, isCity = true, DepPlace = city.Departure_place }); } var allStation = db.Route_Station.ToList(); foreach (var start in startCities) { foreach (var station in allStation) { if (start.Name == station.Route.Departure_place) { endCities.Add(new Point() { Id = station.IdRoute_FK, Name = station.Station.Name, isCity = false, DepPlace = station.Route.Departure_place }); } } } startCities = startCities.Distinct(new CityComparer()).ToList(); SelectStartCity = startCities[0]; SelectEndCity = EndCities[0]; NameStop = ""; CostStop = ""; /*cities = new List<string>() * { * "Шуя", "Иваново", "Москва" * };*/ stops = new ObservableCollection <Stop>(); times = new ObservableCollection <TimeSpan>(); }
public ReportViewModel() { db = new BusStationContext(); }
public JourneysController(BusStationContext context) { _context = context; }
public CitiesAPIController(BusStationContext context) { _context = context; }
public RouteStopsRepository(BusStationContext context) { _busStationContext = context; }
public BusModelsController(BusStationContext context) { _context = context; }
public TimeTablesRepository(BusStationContext context) { _busStationContext = context; }
public ReservationsController(BusStationContext context) { _context = context; }
public FindTicketViewModel() { availableTrips = new ObservableCollection <AvailableTrip>(); _viewId = Guid.NewGuid(); startCities = new List <Point>(); endCities = new ObservableCollection <Point>(); endStations = new ObservableCollection <Point>(); passangers = new List <PassangerModel>(); db = new BusStationContext(); var allCities = db.Route.ToList(); int ind = 0; foreach (var city in allCities) { startCities.Add(new Point() { Id = city.IdRoute, Name = city.Departure_place, isCity = true }); endCities.Add(new Point() { Id = city.IdRoute, Name = city.Arrival_place, isCity = true, DepPlace = city.Departure_place }); } //foreach (var cities in db.Route.ToList().Select(i => new FindTicketModel(i)).ToList()) //{ // startCities.Add(cities); //} //.Join(db.Route_Station, r => r.IdRoute, rs => rs.IdRS, (r, rs) => new { route = r, routeStation = rs }) //.Join(db.Station, rs => rs.routeStation.IdStation_Fk, s => s.IdStation, (rs, s) => new { rs = rs, stations = s }) //.GroupBy(s => s.stations.Name) var allStation = db.Route_Station.ToList(); foreach (var start in startCities) { foreach (var station in allStation) { if (start.Name == station.Route.Departure_place) { endCities.Add(new Point() { Id = station.IdRoute_FK, Name = station.Station.Name, isCity = false, DepPlace = station.Route.Departure_place }); } } } startCities = startCities.Distinct(new CityComparer()).ToList(); SelectStartCity = startCities[0]; SelectEndCity = EndCities[0]; DepartureDate = DateTime.Today; PassengerNumber = 1; //foreach (var cities in db.Route.ToList().Select(i => new FindTicketModel(i)).GroupBy(x => x.EndCities).Select(j => j.First()).ToList()) //{ // endStations.Add(cities); //} //foreach (var cities in db.Route.ToList().Select(i => new FindTicketModel(i)).GroupBy(x => x.EndCities).Select(j => j.First()).ToList()) //{ // endCities.Add(cities); //} //foreach (var item in endStations) //{ // endCities.Add(item); //} }
public TypeStopsRepository(BusStationContext busStationContext) { _busStationContext = busStationContext; }
public ClientsController(BusStationContext context) { _context = context; }
public UnitOfWorkService(string connectionString) { _busStationContext = new BusStationContext(connectionString); }
public OrdersRepository(BusStationContext context) { _busStationContext = context; }
public RoutesController(BusStationContext context) { _context = context; }
public UsersRepository(BusStationContext busStationContext) { _busStationContext = busStationContext; }