예제 #1
0
 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));
        }
예제 #3
0
 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());
 }