public EncounterDto AddEncounter(EncounterDto anEncounter) { Encounter toAdd = TryCreateEncounter(anEncounter); Encounter added = AddEncounter(toAdd); return(encounterConverter.ToDto(added)); }
private ICollection <EncounterDto> AddFixture(ICollection <Team> teamsCollection) { ICollection <Encounter> added = new List <Encounter>(); try { ICollection <Encounter> generatedMatches = fixtureAlgorithm.GenerateFixture(teamsCollection); AddMatches(ref added, generatedMatches); logger.Log(LogType.FIXTURE, LogMessage.FIXTURE_OK, GetConnectedUserName(), DateTime.Now); } catch (TeamAlreadyHasEncounterException e) { RollBack(added); logger.Log(LogType.FIXTURE, LogMessage.FIXTURE_WRONG + " " + e.Message, GetConnectedUserName(), DateTime.Now); throw new WrongFixtureException(e.Message); } catch (InvalidTeamCountException e) { RollBack(added); logger.Log(LogType.FIXTURE, LogMessage.FIXTURE_WRONG + " " + e.Message, GetConnectedUserName(), DateTime.Now); throw new WrongFixtureException(e.Message); } return(added.Select(e => mapper.ToDto(e)).ToList()); }
private ICollection <EncounterDto> GetEncounterDtos(ICollection <Encounter> encounters) { EncounterDtoMapper mapper = new EncounterDtoMapper(); return(encounters.Select(e => mapper.ToDto(e)).ToList()); }