Ejemplo n.º 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());
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 4
0
 public IActionResult Get()
 {
     try
     {
         return(Ok(_stationService.GetAll().ToApiModels()));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("GetStation", ex.Message);
         return(BadRequest(ModelState));
     }
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 7
0
 public IHttpActionResult Station(HttpRequestMessage requestMessage)
 {
     return(Ok(_stationService.GetAll().FirstOrDefault()));
 }
Ejemplo n.º 8
0
 public async Task <IEnumerable <Station> > GetAll([FromQuery] StationParameters stationParameters)
 {
     return(await _service.GetAll(stationParameters));
 }
Ejemplo n.º 9
0
        public ActionResult Index()
        {
            var d = _stationService.GetAll().FirstOrDefault().With(s => s.Name);

            return(View());
        }