/// <summary> /// The create app user with membership. /// </summary> /// <param name="appUser"> /// The app user. /// </param> /// <param name="registeringUser"> /// The registering user. /// </param> /// <param name="contact"> /// The contact. /// </param> public void CreateAppUserWithMembership(IAppUser appUser, IRegistringUser registeringUser, IContact contact) { var memUser = MsMembership.CreateUser(registeringUser.UserName, registeringUser.Password, registeringUser.Email); var appuser = appUser.ToEntity(); if (memUser.ProviderUserKey != null) { var user = GetUser(Guid.Parse(memUser.ProviderUserKey.ToString())); user.AppUsers.Add(appuser); Roles.AddUserToRole(registeringUser.UserName, registeringUser.Role); AddContact(contact); contact.AppUsers.Add(appuser); Commit(); } }