// GET: Station/Details/5 public IActionResult Details(int?id) { log.Info(nameof(StationController.Details)); if (id == null) { log.Warn(nameof(StationController.Details) + " id is null"); return(NotFound()); } try { var station = stationService.Get(id.Value); if (station == null) { log.Warn(nameof(StationController.Details) + " station is null"); return(NotFound()); } else { return(View(station)); } } catch (Exception e) { log.Error(e); return(BadRequest()); } }
public ActionResult Index() { IEnumerable <StationParam> list_param = _StationService.Get().Select(x => new StationParam { Id = x.Id, Name = x.Name.ToString(), Districts = x.Districts }); return(View(list_param)); }
public async Task <IActionResult> Get(int id) { if (id < 1) { return(NotFound()); } var model = _stationService.Get(id); return(Ok(model)); }
public IActionResult Get(int id) { try { var station = _stationService.Get(id); if (station is null) { return(null); } return(Ok(station.ToApiModel())); } catch (Exception ex) { ModelState.AddModelError("GetStations", ex.Message); return(BadRequest(ModelState)); } }
public async Task <IActionResult> OnGetAsync(string id) { if (id == null) { return(NotFound()); } Audience = await _audienceService.GetAsync(id); if (Audience == null) { return(NotFound()); } Audience.Emissora_Nome = _stationService.Get(Audience.Emissora_Audiencia)?.Nome; return(Page()); }
public void RefreshTickets() { int price = trainService.Get(SelectedTrainId).Data.RoutePropereties.Last().Price; VanDTO neededVan = vanService.Get(SelectedVanId).Data; int idClass = neededVan.ClassProperetiesId; price += classProperetiesService.Get(idClass).Data.Price; int passangerId = passangerService.GetAll() .Data.Last().Id; TicketDTO ticket = new TicketDTO() { VanId = SelectedVanId, SeatId = SelectedSeatId, TrainId = SelectedTrainId, Price = price, PassangerId = passangerId }; SelectedStation = stationService.Get(SelectedStationId).Data; SelectedTrain = trainService.Get(SelectedTrainId).Data; SelectedVan = vanService.Get(SelectedVanId).Data; SelectedSeat = seatService.Get(SelectedSeatId).Data; ticketService.Add(ticket); ticketService.Save(); Ticket = ticket; OnPropertyChanged(nameof(SelectedStation)); OnPropertyChanged(nameof(SelectedTrain)); OnPropertyChanged(nameof(SelectedVan)); OnPropertyChanged(nameof(SelectedSeat)); OnPropertyChanged(nameof(Ticket)); OnPropertyChanged(nameof(Stations)); }
public IActionResult GetStation([SwaggerParameter("Int", Required = true)] int id) { log.Info(nameof(StationsController.GetStation)); try { var station = stationService.Get(id); if (station == null) { log.Warn(nameof(StationsController.GetStation) + " station is null"); return(NotFound()); } return(Ok(station)); } catch (Exception e) { log.Error(e); return(BadRequest()); } }
private void InitializeDataAsync() { Task.Run(() => _stationService.Get()) .ContinueWith(res => _stationSource.AddRange(res.Result)); }
public override async Task InitializeAsync() { Station = await _stationService.Get(_communityId, _stationId); _bikeService.ObserveBikesFromStation(Station).Subscribe(bikes => Bikes.ReplaceRange(bikes)); }