public ActionResult <VehiclesModel> Get(string id) { try { if (string.IsNullOrWhiteSpace(id)) { return(new StatusCodeResult((int)HttpStatusCode.BadRequest)); } int.TryParse(id, out int Id); VehiclesModel vehiclesModel = _vehicleService.GetVehicleDetailsById(Id); return(Ok(vehiclesModel)); } catch (ArgumentNullException ane) { return(BadRequest(ane.Message)); } catch (Exception ex) { _logger?.LogCritical("There was an error on '{0}' invocation: {1}", nameof(Get), ex); return(new StatusCodeResult((int)HttpStatusCode.InternalServerError)); } }