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>(); }
private RoundMember(BandMember member, Round round) { Member = member; Round = round; Scoring = Score.Zero; round.TrackMember(this); }
private Round(int id, string name, string place, DateTime dateTime, BandMember sheriff, IEnumerable <BandMember> members) { Id = id; Name = name; Place = place; DateTime = dateTime; Sheriff = RoundMember.From(sheriff, this); Members = members.Select(m => RoundMember.From(m, this)).ToList(); }
public static BandMember ToDtoBand(this Models.BandMember band) { return(new BandMember { Id = band.Band.Id, Band = band.Band.Name, Scoring = band.Scoring.ToDto() }); }
public static MemberBand ToDtoMember(this Models.BandMember member) { return(new MemberBand { Id = member.Bandit.Id, Member = member.Bandit.Name, Scoring = member.Scoring.ToDto() }); }
public bool CanCreateRound(BandMember sheriff) { if (sheriff == null) { throw new ArgumentNullException(nameof(sheriff)); } if (!Members.Contains(sheriff)) { return(false); } return(Members.All(m => m.Rounds.Count >= sheriff.Rounds.Count)); }
public static RoundMember From(BandMember member, Round round) { if (member == null) { throw new ArgumentNullException(nameof(member)); } if (round == null) { throw new ArgumentNullException(nameof(round)); } return(new RoundMember(member, round)); }
public static Round Create(int id, string name, string place, DateTime dateTime, BandMember sheriff, IEnumerable <BandMember> members) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException(Strings.NullOrEmpty.Format(nameof(name)), nameof(name)); } if (string.IsNullOrEmpty(place)) { throw new ArgumentException(Strings.NullOrEmpty.Format(nameof(place)), nameof(place)); } if (sheriff == null) { throw new ArgumentNullException(nameof(sheriff)); } if (members == null) { throw new ArgumentNullException(nameof(members)); } if (members.Any(m => m == null)) { throw new ArgumentException(Strings.ContainsNull.Format(nameof(members)), nameof(members)); } if (members.Any(m => m.Band != sheriff.Band)) { throw new ArgumentException(Strings.ShouldBeInSameBand, nameof(members)); } return(new Round(id, name, place, dateTime, sheriff, members)); }