コード例 #1
0
        public bool SaveContactInfo(Models.Contact contactModel)
        {
            var iMapper = Mapping.MappingProfile.GetMapper();
            var contact = iMapper.Map <ContactDiaryDataAccess.Contact>(contactModel);

            return(_contactDataAccess.SaveContactInfo(contact));
        }
コード例 #2
0
ファイル: Searcher.cs プロジェクト: frize/CloudPhoneBook
        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;

            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        /// <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();
        }
コード例 #5
0
ファイル: Contact.cs プロジェクト: frize/CloudPhoneBook
 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();
     }
 }
コード例 #6
0
        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));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 public bool UpdateContactInfo(Models.Contact contact)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
ファイル: DataService.cs プロジェクト: mjmilan/crisischeckin
 public void AddContact(Contact newContact)
 {
     context.Contacts.Add(newContact);
     context.SaveChanges();
 }