Exemplo n.º 1
0
 public IHttpActionResult GetAllContacts()
 {
     try
     {
         var allContacts = _ContactModel.GetAllContacts();
         return(Ok(allContacts));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Exemplo n.º 2
0
        private async void GetContacts()
        {
            try
            {
                ContactModel categoryModel = new ContactModel(db);
                var          contacts      = await categoryModel.GetAllContacts();

                allContacts = contacts;
                LoadContacts(contacts);
                btnDelete.Enabled = false;
                btnEdit.Enabled   = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                MessageBox.Show("Failed to get categories");
            }
        }
Exemplo n.º 3
0
        public IActionResult Index(string id, string search)
        {
            List <ContactModel> listeContacts;

            if (id != null)
            {
                ViewBag.message = id;
            }
            if (search == null)
            {
                listeContacts = ContactModel.GetAllContacts();
            }
            else
            {
                listeContacts = ContactModel.GetContactsBySearch(search);
            }
            return(View(listeContacts));
        }
 // GET: Contact
 public IEnumerable <Contact> GetAllContacts()
 {
     return(contactModel.GetAllContacts());
 }