public IActionResult CreateVehicleType([FromBody] CreateVehicleTypeDto vehicleTypeDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _vehicleService.CreateVehicleType(vehicleTypeDto); } catch (Exception) { return(BadRequest("Invalid details entered")); } return(Ok()); }
public void CreateVehicleType(CreateVehicleTypeDto vehicleTypeDto) { _repositoryFactory.VehicleRepository.SaveVehicleType(_mapper.Map <VehicleType>(vehicleTypeDto)); _logger.LogInformation("Vehicle type created"); }