public async Task <ActionResult <ContactDto> > GetContact(int id) { try { Contact contactFromRepo = await _repository.GetContact(id); if (contactFromRepo == null) { return(NotFound()); } ContactDto contact = _mapper.Map <ContactDto>(contactFromRepo); return(Ok(contact)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError)); } }