private void InitializeRoutes()
        {
            var allRoutes = routeService.GetAll().Select(x => new RouteDataGridItemVM(x));

            routesList.AutoGenerateColumns = true;
            routesList.ItemsSource         = allRoutes;
        }
        public String Get()
        {
            try
            {
                var routes = _routeService.GetAll();

                var result = Util.RoutesToString(routes);

                return(result);
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }
        }
Ejemplo n.º 3
0
        public ActionResult <List <RoutePatchDTO> > GetAll()
        {
            var routes = _RouteService.GetAll();
            List <RoutePatchDTO> list = routes.Select(x => new RoutePatchDTO
            {
                Id    = x.Id,
                Name  = x.Name,
                Stops = _StopToRouteService.GetStops(x.Id).Select(stop => new RouteStopDTO
                {
                    StopId      = stop.TrainStopId,
                    StopNo      = stop.StopNo,
                    HoursDiff   = stop.HoursDiff,
                    MinutesDiff = stop.MinutesDiff
                }).ToList()
            }).ToList();

            return(Ok(list));
        }
Ejemplo n.º 4
0
        private void Filter(object sender, RoutedEventArgs e)
        {
            routesList.Items.Clear();

            var allRoutes = routeService.GetAll();

            if (needCountryNameFilter.IsChecked.GetValueOrDefault())
            {
                allRoutes = allRoutes.Where(x => x.ToCity.Country.Name == countryNameFilter.Text).ToList();
            }

            if (needTypeFilter.IsChecked.GetValueOrDefault())
            {
                if (needToIncludeFlights.IsChecked.GetValueOrDefault() && !needToIncludeBuses.IsChecked.GetValueOrDefault())
                {
                    allRoutes = allRoutes.Where(x => x.IsFlight).ToList();
                }
                else if (!needToIncludeFlights.IsChecked.GetValueOrDefault() && needToIncludeBuses.IsChecked.GetValueOrDefault())
                {
                    allRoutes = allRoutes.Where(x => !x.IsFlight).ToList();
                }
            }

            if (needPriceFilter.IsChecked.GetValueOrDefault())
            {
                allRoutes = allRoutes.Where(x => x.Price >= double.Parse(lowLimitPrice.Text) && x.Price <= double.Parse(hightLimitPrice.Text)).ToList();
            }

            if (needDateFilter.IsChecked.GetValueOrDefault())
            {
                allRoutes = allRoutes.Where(x => x.StartDate >= DateTime.Parse(lowLimitDate.Text) && x.EndDate <= DateTime.Parse(highLimitDate.Text)).ToList();
            }

            allRoutes.ForEach(x => routesList.Items.Add(new RouteVM(x)));
            routesList.DisplayMemberPath = "DisplayValue";
        }
        public IHttpActionResult Get([FromUri] TableFilter filter)
        {
            var dataAndCount = _routeService.GetAll(filter);

            return(Ok(dataAndCount));
        }
Ejemplo n.º 6
0
 public ActionResult <List <Route> > Get() =>
 _routeService.GetAll();
        // GET: Routes
        public ActionResult Index()
        {
            var items = _routeService.GetAll(User.Identity.GetUserId());

            return(View(items));
        }