public async Task<ParagemRegisto> GetParagemRegistoOnGoingAsync(int registoId)
{
return await = _context.ParagensRegistos
.Where(pr => pr.RegistoId == registoId && pr.HoraFim == null)
.FirstAsync();
}
This causes a null reference exception when there's no records found. How can I make it so it returns null if that is the case?