// // GET: /Contacts/Details/5 public ActionResult Details(int id = 0) { Contact contact = repo.Get(c => c.ID == id); if (contact == null) { return(HttpNotFound()); } return(View(contact)); }
public ActionResult <string> Get(string id) { try { var guid = Guid.Parse(id); var contact = ContactsRepository.Get(guid); if (contact != null) { var contactModel = GetContactModel(contact); return(Content(contactModel.ToString())); } return("Not Found"); } catch { return("Id is Incorrect"); } }
// // GET api/contacts/guid // public Contact Get(Guid id) { var contact = repo.Get(id); if (contact == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(contact); }
// // GET api/contacts/guid // public Customer Get(string id) { var contact = repo.Get(id); if (contact == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(contact); }
public IActionResult Get() { try { var repoContacts = new ContactsRepository(_context); var contacts = repoContacts.Get(); return(Ok(contacts)); } catch (Exception e) { throw new Exception(e.Message); } }
public IActionResult Get(int id) { try { var repoContacts = new ContactsRepository(_context); var contact = repoContacts.Get(id); if (contact is null) { return(NotFound()); } return(Ok(contact)); } catch (Exception e) { throw new Exception(e.Message); } }
public IEnumerable <Contact> Get() { return(_repo.Get()); }
private async void OnWindowLoad(object sender, RoutedEventArgs e) { var contacts = await repository.Get(); contacts.ForEach(c => contactListView.Items.Add(c)); }