public bool SaveContactInfo(Models.Contact contactModel) { var iMapper = Mapping.MappingProfile.GetMapper(); var contact = iMapper.Map <ContactDiaryDataAccess.Contact>(contactModel); return(_contactDataAccess.SaveContactInfo(contact)); }
public List<Contact> search(String search, int index, int nbLines) { if (cache.Count > 0) { List<Contact> contacts = new List<Contact>(); for (int i = index; i < index + nbLines; i++) { Contact contact = new Contact(cache[i]); //Console.WriteLine(string.Format("{0}", contact.name)); if (contact.name.ToLower().Contains(search.ToLower())) { contacts.Add(contact); } } return contacts; } else { List<Contact> contacts = new List<Contact>(); IEnumerable<string> fileLines = File.ReadLines(dbFileName).Skip(index + 1).Take(10000000); foreach (string line in fileLines) { Contact contact = new Contact(line); if (contact.name.ToLower().Contains(search.ToLower())) { contacts.Add(contact); } } return contacts; } }
public List <Models.Contact> GetContactListInfo() { List <Models.Contact> resultContactList = new List <Models.Contact>(); var iMapper = Mapping.MappingProfile.GetMapper(); var contactList = _contactDataAccess.GetContacts(); foreach (var item in contactList) { Models.Contact contact = new Models.Contact(); resultContactList.Add(iMapper.Map <Models.Contact>(item)); } return(resultContactList); }
/// <summary> /// Evenement produit lors d'un click sur le bouton ajouter /// </summary> public async void AddEmail_Click(object sender, EventArgs e) { //Déclaration d"un nouvel objet Contact, vide var newContact = new Models.Contact(); //L'emaiol saisie est ajouté au contact précédemment crée newContact.Email = this.inputEmail.Text; newContact.CampagneId = this.currentCampagne.Id; //Appel au service permettant de créer un contact await this.contactService.AddEmail(newContact); //Le champs de saisie est remit à null this.inputEmail.Text = null; //On charge de nouveau les emails this.LoadEmails(); }
public static void GenerateContactFile(string fileName) { if (!File.Exists(fileName)) { //if exist --> read data //Random data --> save to file StreamWriter sw = new StreamWriter(fileName); int nbContacts = 10000000; sw.WriteLine(nbContacts); for (int i = 0; i < nbContacts; i++) { Contact randomContact = new Contact(); sw.WriteLine(randomContact.getString()); } sw.Close(); } }
public async Task <ActionResult <ContactViewModel> > PostPerson(ContactViewModel viewModel) { var contact = new Models.Contact() { Email = viewModel.Email, CreateDate = viewModel.RegisterDate, Telephone = viewModel.Telephone, Name = viewModel.Name, Text = viewModel.Text }; await UnitOfWork.ContactRepository.Insert(contact); //_context.People.Add(person); await UnitOfWork.SaveAsync(); return(CreatedAtAction("GetContact", new { id = viewModel.Id }, viewModel)); }
public Models.Contact UpdateContactInfo(Models.Contact contact) { var iMapper = Mapping.MappingProfile.GetMapper(); var result = _contactDataAccess.GetContactById(contact.ID); if (result != null) { var contactModel = iMapper.Map <Models.Contact>(result); contactModel.FirstName = contact.FirstName; contactModel.LastName = contact.LastName; contactModel.Email = contact.Email; contactModel.PhoneNumber = contact.PhoneNumber; contactModel.Status = contact.Status; contactModel.ModifiedDate = DateTime.Now; _contactDataAccess.SaveContactInfo(iMapper.Map <ContactDiaryDataAccess.Contact>(contactModel)); return(contactModel); } return(null); }
public bool UpdateContactInfo(Models.Contact contact) { throw new NotImplementedException(); }
public void AddContact(Contact newContact) { context.Contacts.Add(newContact); context.SaveChanges(); }