public void ShowAllContact() { var listContact = _iContactRepo.GetAllContacts(); foreach (var item in listContact) { Console.WriteLine("Name: " + item.Name + ", Phone: " + item.Phone); } }
public async Task <IActionResult> GetContacts() { try { var result = await _contactRepo.GetAllContacts(); if (result != null) { return(Ok(result)); } else { return(NoContent()); } } catch (Exception ex) { return(StatusCode((int)System.Net.HttpStatusCode.InternalServerError, ex.Message)); } }
public ActionResult <IEnumerable <Contact> > GetAllContacts() { var contacts = _repo.GetAllContacts(); return(Ok(contacts)); }
public async Task <IActionResult> GetContacts() { var contacts = await _repo.GetAllContacts(); return(Ok(contacts)); }