private static int CalculateMaximumPlayers(TeamFormat teamFormat) { switch (teamFormat) { case TeamFormat.FourPlusOne: return(10); case TeamFormat.FivePlusOne: return(12); case TeamFormat.SixPlusOne: return(14); case TeamFormat.ElevenPlayers: return(22); default: return(-1); } }
public async Task <string> AddAsync(string title, string description, DateTime startingAt, TeamFormat teamFormat, string pitchId, string creatorId) { var maximumPlayers = CalculateMaximumPlayers(teamFormat); var gather = new Gather { Title = title, Description = description, StartingAt = startingAt, TeamFormat = teamFormat, PitchId = pitchId, CreatorId = creatorId, Status = GameStatus.Registration, MaximumPlayers = maximumPlayers }; await this.gatherRepository.AddAsync(gather); await this.gatherRepository.SaveChangesAsync(); return(gather.Id); }