示例#1
0
        public EncounterDto AddEncounter(EncounterDto anEncounter)
        {
            Encounter toAdd = TryCreateEncounter(anEncounter);
            Encounter added = AddEncounter(toAdd);

            return(encounterConverter.ToDto(added));
        }
示例#2
0
        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());
        }
示例#3
0
        private ICollection <EncounterDto> GetEncounterDtos(ICollection <Encounter> encounters)
        {
            EncounterDtoMapper mapper = new EncounterDtoMapper();

            return(encounters.Select(e => mapper.ToDto(e)).ToList());
        }