Beispiel #1
0
        public async Task <IActionResult> Delete(string train_id)
        {
            var trainDTO = await _trainService.GetByIdAsync(train_id);

            if (trainDTO == null)
            {
                return(NotFound());
            }

            try
            {
                var trainVM = Mapper.Map <TrainDTO, TrainVM>(trainDTO);
                await _trainService.DeleteAsync(train_id);

                return(Ok(trainVM));
            }
            catch (BusinessLogicException ex)
            {
                return(BadRequest(ex.Message));
            }
        }