public async Task <ObjectResult> UpdateTrainStationAsync([FromBody] GeneralTrainStationRequest request, [FromRoute] int id)
        {
            TrainStation result = _trainStationServices.TrainStationRepository.Update(request.ToDTO(id));
            await _trainStationServices.CommitChanges();

            return(Ok(result));
        }
        public async Task <ObjectResult> CreateTrainStationAsync([FromBody] GeneralTrainStationRequest request)
        {
            TrainStation result = await _trainStationServices.TrainStationRepository.CreateAsync(request.ToDTO());

            await _trainStationServices.CommitChanges();

            return(Ok(result));
        }
Exemple #3
0
 public static TrainStation ToDTO(this GeneralTrainStationRequest request)
 {
     return(new TrainStation
     {
         TrainID = request.TrainID,
         StationID = request.StationID,
         StationNumber = request.StationNumber,
         ArrivalTime = request.ArrivalTime,
         LeftTime = request.LeftTime
     });
 }