示例#1
0
        public void Toggle(CardMemberViewModel model)
        {
            if (model.Toggle())
            {
                // now attached
                _otherMembers.Remove(model);
                _members.Add(model);

                var evt = new CardMemberAdded
                {
                    CardId     = Id,
                    MemberId   = model.Id,
                    AvatarHash = model.AvatarHash,
                    FullName   = model.FullName,
                    Username   = model.Username
                };
                _eventAggregator.Publish(evt);
            }
            else
            {
                // now unattached
                _members.Remove(model);
                _otherMembers.Insert(0, model);

                var evt = new CardMemberRemoved
                {
                    CardId   = Id,
                    MemberId = model.Id
                };
                _eventAggregator.Publish(evt);
            }
            _eventAggregator.Publish(new MemberAggregationsUpdated {
                AssignedMemberCount = _members.Count
            });
        }
示例#2
0
 public void Handle(CardMemberRemoved message)
 {
     (from card in FindCardViewModel(message.CardId)
      from member in card.FindMember(message.MemberId)
      select new { Card = card, Member = member })
     .IfHasValueThenDo(tuple => tuple.Card.Members.Remove(tuple.Member));
 }
示例#3
0
 public void Handle(CardMemberRemoved message)
 {
     Analytics.TagEvent("Update_Card_Member_Remove");
     Handle(api => api.Cards.RemoveMember(new CardId(message.CardId), new MemberId(message.MemberId)));
 }