public void DeleteUser(int contactId)
        {
            var logic = new ContactBUS();
            var contact = logic.GetContact(contactId);

            Membership.DeleteUser(contact.Username);
        }
示例#2
0
        public static ValidationResult ValidateUniqueUsername(string username, ValidationContext context)
        {
            if (username == null)
                return ValidationResult.Success;

            var logic = new ContactBUS();
            var contact = context.ObjectInstance as Contact;
            var oldInfo = logic.GetContact(contact.Id);
            if (oldInfo == null || oldInfo.Username.ToLower() != username.ToLower())
                if(logic.UsernameExists(username))
                    return new ValidationResult("username exists in system");

            return ValidationResult.Success;
        }
 public void RemoveUserFromRole(int contactId, string role)
 {
     var logic = new ContactBUS();
     var contact = logic.GetContact(contactId);
     Roles.RemoveUserFromRole(contact.Username, role);
 }
 public bool CreateUser(int contactId)
 {
     var logic = new ContactBUS();
     var contact = logic.GetContact(contactId);
     return Membership.CreateUser(contact.Username, "Password", contact.Email);
 }
 public void AddUserToRole(int contactId, string role)
 {
     var logic = new ContactBUS();
     var contact = logic.GetContact(contactId);
     Roles.AddUserToRole(contact.Username, role);
 }