Beispiel #1
0
        public void ShowAllContact()
        {
            var listContact = _iContactRepo.GetAllContacts();

            foreach (var item in listContact)
            {
                Console.WriteLine("Name: " + item.Name + ", Phone: " + item.Phone);
            }
        }
Beispiel #2
0
        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));
            }
        }
Beispiel #3
0
        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));
        }