Beispiel #1
0
 private BandMember(Bandit bandit, Band band)
 {
     Bandit  = bandit;
     Band    = band;
     Scoring = Score.Zero;
     Rounds  = new List <RoundMember>();
 }
Beispiel #2
0
 private Notification(int id, Bandit bandit, string title, string body)
 {
     Id     = id;
     Bandit = bandit;
     Title  = title;
     Body   = body;
 }
Beispiel #3
0
 public Invitation(int id, Bandit guest, Band band, Bandit handler)
 {
     Id      = id;
     Guest   = guest;
     Band    = band;
     Handler = handler;
 }
Beispiel #4
0
 private Band(int id, string name, Bandit boss, IEnumerable <Bandit> members)
 {
     Id      = id;
     Name    = name;
     Boss    = BandMember.From(boss, this);
     Members = members.Select(m => BandMember.From(m, this)).ToList();
     Rounds  = new List <Round>();
 }
Beispiel #5
0
        public static Notification For(int id, Bandit bandit, string title, string body)
        {
            if (bandit == null)
            {
                throw new ArgumentNullException(nameof(bandit));
            }

            return(new Notification(id, bandit, title, body));
        }
Beispiel #6
0
 public static Bandit ToDto(this Models.Bandit bandit)
 {
     return(new Bandit
     {
         Id = bandit.Id,
         Name = bandit.Name,
         Scoring = bandit.Scoring.ToDto()
     });
 }
Beispiel #7
0
 public static BanditDetails ToDtoDetails(this Models.Bandit bandit)
 {
     return(new BanditDetails
     {
         Id = bandit.Id,
         Name = bandit.Name,
         Email = bandit.Email.Address,
         Scoring = bandit.Scoring.ToDto(),
         Bands = bandit.Bands
                 .Select(b => b.ToDtoBand())
                 .ToArray()
     });
 }
Beispiel #8
0
        public static BandMember From(Bandit bandit, Band band)
        {
            if (bandit == null)
            {
                throw new ArgumentNullException(nameof(bandit));
            }

            if (band == null)
            {
                throw new ArgumentNullException(nameof(band));
            }

            return(new BandMember(bandit, band));
        }
Beispiel #9
0
        public static Invitation Create(int id, Bandit guest, Band band, Bandit handler)
        {
            if (guest == null)
            {
                throw new ArgumentNullException(nameof(guest));
            }

            if (band == null)
            {
                throw new ArgumentNullException(nameof(band));
            }

            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            return(new Invitation(id, guest, band, handler));
        }
Beispiel #10
0
        public static Band Create(int id, string name, Bandit boss, IEnumerable <Bandit> members)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException(Strings.NullOrEmpty.Format(nameof(name)), nameof(name));
            }

            if (boss == null)
            {
                throw new ArgumentNullException(nameof(boss));
            }

            if (members == null)
            {
                throw new ArgumentNullException(nameof(members));
            }

            if (members.Any(m => m == null))
            {
                throw new ArgumentException(Strings.ContainsNull.Format(nameof(members)), nameof(members));
            }

            return(new Band(id, name, boss, members));
        }
Beispiel #11
0
 public static Band Create(int id, string name, Bandit boss)
 {
     return(Create(id, name, boss, Enumerable.Empty <Bandit>()));
 }
Beispiel #12
0
 public static Band Create(string name, Bandit boss)
 {
     return(Create(0, name, boss));
 }
Beispiel #13
0
 public bool IsMember(Bandit bandit)
 {
     return(Members.Any(m => m.Bandit.Id == bandit.Id));
 }
Beispiel #14
0
 public bool CanRequestToJoin(Bandit newMember)
 {
     return(!IsMember(newMember));
 }
Beispiel #15
0
 public void UpdateScoring(Score score)
 {
     Scoring.Add(score);
     Bandit.UpdateScoring(score);
 }
Beispiel #16
0
 public static Notification For(Bandit bandit, string title, string body)
 {
     return(For(0, bandit, title, body));
 }
Beispiel #17
0
 public static Invitation Create(Bandit guest, Band band, Bandit handler)
 {
     return(Create(0, guest, band, handler));
 }
Beispiel #18
0
 public static Notification For(Bandit bandit, Message message)
 {
     return(For(bandit, message.Title, message.Body));
 }
Beispiel #19
0
 public bool CanInviteToJoin(Bandit newMember)
 {
     return(Band.Boss.Bandit.Id == Bandit.Id &&
            !Band.IsMember(newMember));
 }