public TextProtocolBuilderFake(GameNoteBuilder gameNoteBuilder) { Guard.CheckNull(gameNoteBuilder, nameof(gameNoteBuilder)); this.gameNoteBuilder = gameNoteBuilder; IGameFormatManager gameFormatManager = MainCfg.ServiceProvider.GetService <IGameFormatManager>();; protocolModelUtils = new ProtocolModelUtils(gameFormatManager); }
public IEnumerable <PersonStatistics> Post(int id, [FromBody] ProtocolGameViewModel protocolView) { if (!ModelState.IsValid) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(null); } gameBll.FillRounds = true; Game game = gameBll.GetGame(id); if (game == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(null); } ProtocolGameViewModel oldProtocolView = GetDefaultProtocol(game); var records = protocolView.ToRecordsList(); int count = protocolBll.SaveProtocol(id, records); var gameNoteBuilder = new GameNoteBuilder(game); gameNoteBuilder.FakeProtocol = protocolView.fake; gameBll.SaveGame(gameNoteBuilder.Game); IEnumerable <int> personIds = GetAllPersonIdsFromBothProtocols(oldProtocolView, new ProtocolGameViewModel()); personBll.FillPersonCareer = true; IEnumerable <Person> persons = personBll.GetPersons(personIds); IEnumerable <PersonStatistics> personStatistics = personStatisticsBll.CalculateTourneyStatistics(game.round.tourneyId, persons); personStatisticsBll.SavePersonStatistics(game.round.tourneyId, personStatistics); return(personStatistics); }
public static ITextProtocolBuilder Create(GameNoteBuilder gameNoteBuilder) { return(new TextProtocolBuilderFake(gameNoteBuilder)); }