I'm trying to make a request for a customer and if the customer doesn't exist it should return some kind of "Not found" page. Which of the below would be the best practice to use for such a task, and why?
public ActionResult Index(int id)
{
if (customerService.GetCustomerById(id) == null)
return View("NotFound");
return View();
}
or
public ActionResult Index(int id)
{
if (customerService.GetCustomerById(id) == null)
throw new HttpException(404, "Customer not found");
return View();
}