public IActionResult GetContactById(int id) { if (id == 0) { return(BadRequest()); } var foundContact = _contactsService.GetContactById(id); if (foundContact == null) { return(NotFound()); } try { return(Ok(_contactsService.GetContactById(id))); } catch (Exception ex) { log.Error("PublicAddressBookApiError: ", ex); return(StatusCode(StatusCodes.Status500InternalServerError)); } }