Beispiel #1
0
        public async Task <ActionResult <TrainModel> > CreateTrainAsync(CreateTrainModel createTrainModel)
        {
            var trainModel = new TrainModel
            {
                TrainName = createTrainModel.TrainName,
                Wagons    = null
            };
            var createdTrain = await _trainService.CreateTrainAsync(trainModel);

            return(CreatedAtAction(nameof(GetTrainAsync), new { TrainId = createdTrain.TrainId }, createdTrain));
        }