Ejemplo n.º 1
0
        internal void Edit(string name, long editUserId)
        {
            if (Participants.All(participant => participant.Id != editUserId))
            {
                throw new UserFriendlyException("You are not allowed to change this chatRoom.");
            }

            Name = name;
        }
Ejemplo n.º 2
0
        internal void EditParticipants(ICollection <User> participants, long editUserId)
        {
            if (Participants.All(participant => participant.Id != editUserId))
            {
                throw new UserFriendlyException("You are not allowed to change this chatRoom.");
            }

            // Owner must be one of the participants
            if (participants.All(participant => participant.Id != OwnerId))
            {
                participants.Add(Owner);
            }

            Participants.Clear();
            foreach (var participant in participants)
            {
                Participants.Add(participant);
            }
        }