Example #1
0
        public ActionResult Index()
        {
            AllContactVM allContactVM = new AllContactVM();

            allContactVM.Contacts = contactService.GetContacts();

            foreach (var contact in allContactVM.Contacts)
            {
                allContactVM.Addresses.AddRange(addressService.GetAddresses(contact.ID));
            }
            return(View(allContactVM));
        }
        public ActionResult Index(string search)
        {
            AllContactVM contactVM = new AllContactVM();

            if (search == null)
            {
                contactVM.Contacts = contactService.GetContacts();
            }
            else
            {
                contactVM.Contacts = contactService.SearchContact(search);
            }
            return(View(contactVM));
        }