I'm making a call in my repository but the CPF does not always exist in the DB. When it does not exist in the database I get the following error.
Repository
public VendedorModel GetById(int CPF)
{
using (var db = new PowerVendasEntities())
{
var registro = db.Vendedor.Single(x => x.VendedorCPF == CPF);
return VendedorFactory.ToModel(registro);
}
}
What is the best way to solve this problem?