I have a model, in the model a method such as,
public Pages GetPage(int? id)
{
return _dataContext.Pages.First(p => p.id == id);
}
If I pass the wrong parameter (like 123333-no record it database), it throws an exception,
Sequence contains no elements
What is the correct code version, or can try and catch simply be used?