public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var car = _repo.Find(id);

            if (car == null)
            {
                return(NotFound());
            }

            return(View(car));
        }
Exemple #2
0
 public IActionResult OnGet(int?id)
 {
     if (!id.HasValue)
     {
         return(BadRequest());
     }
     Car = _repo.Find(id.Value);
     if (Car == null)
     {
         return(NotFound());
     }
     return(Page());
 }
Exemple #3
0
 internal Car GetOneCar(int?id)
 => !id.HasValue ? null : _repo.Find(id.Value);
Exemple #4
0
 internal Car GetOneCar(int?id)
 {
     return(id == null ? null :  _repo.Find(id.Value));
 }
 public IActionResult RazorSyntax([FromServices] ICarRepo carRepo)
 {
     return(View(carRepo.Find(1)));
 }
Exemple #6
0
 internal Car GetOneCar(int?id)
 => id == null ? null : _repo.Find(id.Value);