Exemplo n.º 1
0
        public ActionResult <RoutePatchDTO> GetById([FromRoute] int id) // To do zmiany
        {
            RoutePatchDTO rs    = new RoutePatchDTO();
            var           route = _RouteService.GetById(id);
            var           stops = _StopToRouteService.GetById(id); //should return all

            rs.Id    = route.Id;
            rs.Name  = route.Name;
            rs.Stops = stops;


            return(Ok(rs));
        }
Exemplo n.º 2
0
        private List <SelectListItem> GetOrderListFromRoute(string id)
        {
            var route = routeService.GetById(id);

            var routes = route.RouteEntries;
            // var orders = orderService.GetAllOrders();
            List <SelectListItem> orderNames = new List <SelectListItem>();

            foreach (var order in routes)
            {
                orderNames.Add(new SelectListItem(order.Order.DeliveryAddress.PostalCode, order.Id.ToString()));
            }
            return(orderNames);
        }
Exemplo n.º 3
0
        public ActionResult <List <Ride> > GetAll()
        {
            var r     = _rideService.GetAll();
            var rides = r.Select(x => new Ride
            {
                Id             = x.Id,
                Price          = x.Price,
                Route          = _routeService.GetById(x.RouteId),
                RouteId        = x.RouteId,
                StartTime      = x.StartTime,
                Train          = _trainService.GetById(x.TrainId),
                TrainId        = x.TrainId,
                IsEveryDayRide = x.IsEveryDayRide
            }).ToList();

            return(Ok(rides));
        }
Exemplo n.º 4
0
        public UpdateRouteWindow(int existingRouteId)
        {
            InitializeComponent();

            countryService = new CountryService();
            routeService   = new RouteService();

            this.existingRoute = routeService.GetById(existingRouteId);

            InitializeInitialFields();
            PrepopulateRouteInformation(existingRoute);
        }
Exemplo n.º 5
0
        public IActionResult AssignRoute([FromForm] AssignRouteViewModel data)
        {
            var userId       = userManager.GetUserId(User);
            var dispatcherDb = dispatcherService.GetByUserId(userId);

            if (ModelState.IsValid)
            {
                var driver = driverService.GetByUserId(data.DriverId);
                var route  = routeService.GetById(data.RouteId);
                dispatcherService.ConnectDriverToRoute(route, driver, dispatcherDb);
            }
            return(PartialView("_AssignRoutePartial", data));
        }
Exemplo n.º 6
0
 public RouteModel GetById(int id)
 {
     return(_service.GetById(id));
 }