public ActionResult Index() { IEnumerable <TrainParam> list_param = _TrainService.Get().Select(x => new TrainParam { Id = x.Id, Name = x.Name.ToString() }); return(View(list_param)); }
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)); }