private void GetAllContacts()
 {
     using (IContactService contactMgmt = new ContactMgmtService.ContactMgmtService())
     {
         Contacts = new ObservableCollection <Contact>(contactMgmt.GetAllContacts());
     }
 }
        private void Save_Command(object sender)
        {
            var errorMsg = _contactInfo.Validate();

            if (string.IsNullOrEmpty(errorMsg))
            {
                using (IContactService contactMgmt = new ContactMgmtService.ContactMgmtService())
                {
                    if (_contactInfo.ContactId > 0)
                    {
                        contactMgmt.UpdateContact(ref _contactInfo);
                    }
                    else
                    {
                        contactMgmt.InsertContact(ref _contactInfo);
                    }
                }

                if (CloseWindow != null)
                {
                    CloseWindow(sender, null);
                }
            }
            else
            {
                MessageBox.Show(errorMsg, "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void DeleteContactCommand(object sender)
        {
            var deletContacts = (from contact in Contacts where contact.IsSelected select contact).ToList();

            using (IContactService contactMgmt = new ContactMgmtService.ContactMgmtService())
            {
                contactMgmt.DeleteContact(ref deletContacts);
            }

            GetAllContacts();
        }