public async Task <IActionResult> GetById([Required] string id) { if (string.IsNullOrEmpty(id) || string.IsNullOrWhiteSpace(id)) { return(BadRequest(new { message = "The request id is invalid.", requestId = id })); } var hardware = await service.GetByIdAsync(id); if (hardware != null) { return(Ok(hardware)); } else { return(NotFound(new { message = "The hardware was not found.", requestId = id })); } }