public ActionResult<ToDoItem> GetToDoItem(long? id) { if (id == null) { return BadRequest(new Dictionary<string, string>() { { "message", "Id is required" } }); } long id_NotNull = id.Value; var target_ToDoItem = _service.GetToDoItemById(id_NotNull); if (target_ToDoItem == null) { return NotFound(new Dictionary<string, string>() { { "message", $"Can't find {id}" } }); } return Ok(target_ToDoItem); }