Пример #1
0
        // GET: Station
        public IActionResult Index()
        {
            log.Info(nameof(StationController.Index));

            try
            {
                ViewData["AreaId"] = new SelectList(areaService.GetAreas(), "Id", "Name");

                return(View(stationService.GetAll()));
            }
            catch (Exception e)
            {
                log.Error(e);

                return(BadRequest());
            }
        }
Пример #2
0
        public IActionResult Create()
        {
            log.Info(nameof(RoutesController.Create));

            try
            {
                var stationNames = stationService.GetAll();

                ViewData["StationId"] = new SelectList(stationNames, "Id", "Name");

                return(View());
            }
            catch (Exception e)
            {
                log.Error(e);

                throw;
            }
        }
Пример #3
0
        public void LoadStations()
        {
            ObservableCollection <StationDTO> stations = new ObservableCollection <StationDTO>();

            foreach (StationDTO station in stationService.GetAll().Data.ToList <StationDTO>())
            {
                stations.Add(station);
            }

            Stations = stations;
        }
Пример #4
0
 public IActionResult Get()
 {
     try
     {
         return(Ok(_stationService.GetAll().ToApiModels()));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("GetStation", ex.Message);
         return(BadRequest(ModelState));
     }
 }
Пример #5
0
        public IActionResult GetStations([FromQuery] int pageNumber = 1, [FromQuery] int pageSize = 10)
        {
            log.Info(nameof(StationsController.GetStations));

            try
            {
                var stationPage = stationService
                                  .GetAll()
                                  .ToPage(pageNumber, pageSize);

                return(Ok(stationPage));
            }
            catch (Exception e)
            {
                log.Error(e);

                return(BadRequest());
            }
        }
        public async Task <IActionResult> Get()
        {
            var models = _stationService.GetAll();

            return(Ok(models));
        }
Пример #7
0
 public IHttpActionResult Station(HttpRequestMessage requestMessage)
 {
     return(Ok(_stationService.GetAll().FirstOrDefault()));
 }
Пример #8
0
 public async Task <IEnumerable <Station> > GetAll([FromQuery] StationParameters stationParameters)
 {
     return(await _service.GetAll(stationParameters));
 }
Пример #9
0
        public ActionResult Index()
        {
            var d = _stationService.GetAll().FirstOrDefault().With(s => s.Name);

            return(View());
        }