/// <summary> /// Handles the SaveClick event of the mdAddContact control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void mdAddContact_SaveClick(object sender, EventArgs e) { var rockContext = new RockContext(); var personService = new PersonService(rockContext); var groupService = new GroupService(rockContext); var groupMemberService = new GroupMemberService(rockContext); var business = personService.Get(int.Parse(hfBusinessId.Value)); int?contactId = ppContact.PersonId; if (contactId.HasValue && contactId.Value > 0) { personService.AddContactToBusiness(business.Id, contactId.Value); rockContext.SaveChanges(); } mdAddContact.Hide(); hfModalOpen.Value = string.Empty; BindContactListGrid(business); }