public IActionResult OnGet(int carId) { Car = carData.GetCarById(carId); if (Car == null) { return(RedirectToPage(".NotFound")); } return(Page()); }
public IActionResult GetCar(int id) { var data = carData.GetCarById(id); if (data == null) { return(NotFound()); } return(Ok(data)); }
public IActionResult OnGet(int?carId) { if (carId.HasValue) { Car = carData.GetCarById(carId.Value); if (Car == null) { return(RedirectToPage("./NotFound")); } } else { Car = new Car(); } return(Page()); }