public async Task <ActionResult> UpdateTrainAsync([FromRoute] int trainId, [FromBody] UpdateTrainModel updateTrainModel) { if (trainId != updateTrainModel.TrainId) { return(BadRequest()); } var train = await _trainService.GetTrainAsync(trainId); if (train is null) { return(NotFound()); } var trainModel = new TrainModel { TrainId = trainId, TrainName = updateTrainModel.TrainName, }; await _trainService.UpdateTrainAsync(trainModel); return(Ok()); }