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