public IHttpActionResult GetAllContacts() { try { var allContacts = _ContactModel.GetAllContacts(); return(Ok(allContacts)); } catch (Exception ex) { return(InternalServerError(ex)); } }
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"); } }
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()); }