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ễ
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 ánCùng chương 4
By default, where does the model binder attempt to get the data for a complex type parameter (like a class or record) in an [ApiController] action?Có lời giảiCâu hỏiFor a traditional controller-based Web API in .NET 8/9, which method call in Program.cs is essential for routing to controllers?Có lời giảiCâu hỏiFor the route [HttpGet("users/{userId}/orders/{orderId}")], what are userId and orderId?Có lời giảiCâu hỏiCả 19 câu của chủ đề19 câu