When returning null
value, following code in Web API controller executed successfully without any errors, while debugging it.
But in browser it gives Status Code: 500 Internal Server Error. Please see the attached error image.
[HttpGet("GetPreRegisteredPatientByMrn/{patientId}")]
public async Task<PreRegistrationPatientDetailsDto> GetPreRegisteredPatientByMrn(int patientId)
{
try
{
return await _readService.GetPreRegisteredPatientByMrn(patientId);
}
catch (Exception ex)
{
_logger.LogError(ex.StackTrace);
throw;
}
}
PS - Earlier this code written in .netcore version 2.1.Later updated to .netcore 3.1 version. Internal server error 500 comes in .net core 3.1 version. it works fine with .netcore 2.1 version.