A controller action needs to return a "Not Found" response when a resource does not exist. Which of the following is the best way to achieve this? [HttpGet("{id}")]

4 phương ánDễ
Đề bài
public ActionResult<Product> GetProduct(int id) {
  var product = _productService.GetById(id);
  if (product == null) {
    return ???;
    // What should be here?
  }
  return product;
}

Các phương án trả lời

Chọn một phương án

Cùng chương 4

Xuất hiện trong 3 bộ đề