private void FormViewAllContacts_Load(object sender, EventArgs e) { this.dataGridViewItems.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.dataGridViewItems.Columns[0].Visible = false; this.dataGridViewItems.Columns[1].Visible = false; this.dataGridViewItems.Columns[2].HeaderText = "Name"; this.dataGridViewItems.Columns[3].HeaderText = "email"; this.dataGridViewItems.Columns[4].HeaderText = "Address"; this.dataGridViewItems.Columns[5].HeaderText = "Company"; this.dataGridViewItems.Columns[2].Width = 120; this.dataGridViewItems.Columns[3].Width = 157; this.dataGridViewItems.Columns[4].Width = 150; foreach (Contact contact in contactsRepository.GetAll(AuthenticationService.LoggedUser.Id)) { if (AuthenticationService.LoggedUser.Id == contact.ParentUserId) { this.dataGridViewSubItems.Columns[0].Visible = false; this.dataGridViewSubItems.Columns[1].Visible = false; this.dataGridViewSubItems.Columns[2].HeaderText = "Phones"; this.dataGridViewSubItems.Columns[2].Width = 137; } } }
private void GetAll() { Console.Clear(); ContactsRepository contactsRepository = new ContactsRepository("contacts.txt"); PhonesRepository phonesRepository = new PhonesRepository("phones.txt"); List <Contact> contacts = contactsRepository.GetAll(AuthenticationService.LoggedUser.Id); foreach (Contact contact in contacts) { Console.WriteLine("ID:" + contact.Id); Console.WriteLine("Name :" + contact.FullName); Console.WriteLine("Email :" + contact.Email); List <Phone> phones = phonesRepository.GetAll(contact.Id); foreach (Phone phone in phones) { Console.WriteLine("ID:" + phone.Id); Console.WriteLine("Phone :" + phone.PhoneNumber); } Console.WriteLine("########################################"); } Console.ReadKey(true); }
public void GetAll() { //Arrange var streamCreator = new Mock <IContactsStreamCreator>(); streamCreator.Setup(creator => creator.OpenForRead()).Returns(GetStream); var contactsRepository = new ContactsRepository(streamCreator.Object); //Act Contact[] contacts = contactsRepository.GetAll(); //Asserts Assert.AreEqual(2, contacts.Length); }
public async Task <Document> Post([FromBody] Contact inObj) { //Contact retObj = await _repository.GetAsync("1"); bool retB = _repository.IsEmpty(); if (retB) //|| !retObj.id.Equals("1")) { // if items with id=1 is not found, pill up the collection with local repo // hopefully, this will need to be done ony once foreach (var o in _localContactsRepository.GetAll()) { await _repository.CreateAsync(o); } } // not post the incoming obj. var document = await _repository.CreateAsync(inObj); return(document); }
// // GET api/contacts // public IEnumerable <Contact> Get() { return(repo.GetAll()); }
public IEnumerable <Contact> Get() { return(_contactsRepository.GetAll()); }
// // GET api/contacts // //public IEnumerable<Contact> Get() //{ // return repo.GetAll(); //} public IEnumerable <Customer> Get() { return(repo.GetAll()); }
public IEnumerable <Contacts> GetAll() { return(ContactsRepo.GetAll()); }
// // GET: /Contacts/ public ActionResult Index() { return(View(repo.GetAll().ToList())); }