Crosschat.Server.Domain.Entities.User.Ban C# (CSharp) Метод

Ban() публичный Метод

public Ban ( User bannedBy ) : void
bannedBy User
Результат void
        public void Ban(User bannedBy)
        {
            if (bannedBy.Role != UserRole.Moderator && bannedBy.Role != UserRole.Admin)
                throw new ModeratorsRightsRequiredException();

            if (Role == UserRole.Admin || Role == UserRole.Moderator)
                throw new ModeratorsRightsRequiredException();

            IsBanned = true;
            BannedAt = DateTime.UtcNow;
        }