private void RoleRemovedFromUserEventHandler(RoleRemovedFromUser e) { // TODO: Handle following situation: if(e.UserId != Id) ... var roleToRemove = new UserRole(e.RoleName); _roles.Remove(roleToRemove); }
private void RoleAssignedToUserEventHandler(RoleAssignedToUser e) { // TODO: Handle following situation: if(e.UserId != Id) ... var assignedRole = new UserRole(e.RoleName); if(!_roles.Contains(assignedRole)) { _roles.Add(assignedRole); } }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> public bool Equals(UserRole other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return String.Compare(other.Name, Name, StringComparison.InvariantCultureIgnoreCase) == 0; }