public async Task <IActionResult> Get(int id) { _logger.LogInformation("Start Get Applicant Information for ID: " + id + "."); var result = await _applicantManager.GetApplicantAsync(id); _logger.LogInformation("End Get Applicant Information for ID: " + JsonConvert.SerializeObject(result)); return(Ok(result)); }
public async Task <ActionResult <Applicant> > Get(int id) { try { var applicant = await _applicantManager.GetApplicantAsync(id); if (applicant != null) { _logger.LogInformation($"The applicant with ID: {id} has been found!"); return(applicant); } else { _logger.LogInformation($"The applicant with ID: {id} has not been found!"); } return(NotFound()); } catch (Exception) { _logger.LogError($"An error occurred while trying to read the entry from the database. An applicant with ID: {id} has been requested!"); return(BadRequest()); } }