Beispiel #1
0
        public List <ContactListViewModel> ListContacts(string q)
        {
            var contactRepository = new ContactRepository();
            var sourceRepository  = new SourceRepository();

            IQueryable <Contact>        contacts    = contactRepository.FindByName(q).OrderByDescending(d => d.SubmitDate);
            List <ContactListViewModel> contactList = new List <ContactListViewModel>();

            foreach (Contact c in contacts)
            {
                var vm = new ContactListViewModel();
                vm.contact = c;
                vm.source  = sourceRepository.Find(c.SourceID);
                contactList.Add(vm);
            }
            return(contactList);
        }
Beispiel #2
0
        public List <ContactListViewModel> ListContacts()
        {
            var contactRepository = new ContactRepository();
            var sourceRepository  = new SourceRepository();

            IEnumerable <Contact>       contacts    = contactRepository.ListContacts();
            List <ContactListViewModel> contactList = new List <ContactListViewModel>();

            foreach (Contact c in contacts)
            {
                var vm = new ContactListViewModel();
                vm.contact = c;
                vm.source  = sourceRepository.Find(c.SourceID);
                contactList.Add(vm);
            }
            return(contactList);
        }