本文整理汇总了C#中User.ToGroupMember方法的典型用法代码示例。如果您正苦于以下问题:C# User.ToGroupMember方法的具体用法?C# User.ToGroupMember怎么用?C# User.ToGroupMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.ToGroupMember方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddUser
public virtual void AddUser(User.User user)
{
AssertionConcern.NotNull(user, "User must not be null.");
AssertionConcern.Equals(this.TenantId, user.TenantId, "Wrong tenant for this group.");
AssertionConcern.True(user.IsEnabled, "User is not enabled.");
/*if (this.GroupMembers.Add(user.ToGroupMember()) && !this.IsInternalGroup) {
DomainEventPublisher.Instance.Publish(new GroupUserAdded(this.TenantId, this.Name, user.UserName));
}*/
this.GroupMembers.Add(user.ToGroupMember());
if (!this.IsInternalGroup) {
DomainEventPublisher.Instance.Publish(new GroupUserAdded(this.TenantId, this.Name, user.UserName));
}
}
示例2: IsMember
public virtual bool IsMember(User.User user, GroupMemberService groupMemberService)
{
AssertionConcern.NotNull(user, "User must not be null.");
AssertionConcern.Equals(this.TenantId, user.TenantId, "Wrong tenant for this group.");
AssertionConcern.True(user.IsEnabled, "User is not enabled.");
bool isMember = this.GroupMembers.Contains(user.ToGroupMember());
if(isMember) {
isMember = groupMemberService.ConfirmUser(this, user);
}
else {
isMember = groupMemberService.IsUserInNestedGroup(this, user);
}
return isMember;
}
示例3: RemoveUser
public virtual void RemoveUser(User.User user)
{
AssertionConcern.NotNull(user, "User must not be null.");
AssertionConcern.Equals(this.TenantId, user.TenantId, "Wrong tenant for this group.");
if (this.GroupMembers.Remove(user.ToGroupMember()) && !this.IsInternalGroup) {
DomainEventPublisher.Instance.Publish(new GroupUserRemoved(this.TenantId, this.Name, user.UserName));
}
}