Esempio n. 1
0
 /// <inheritdoc />
 public BanlistWithStatisticsDTO Convert(Banlist banlistToConvert)
 {
     return(new BanlistWithStatisticsDTO(
                name: banlistToConvert.Name,
                format: banlistToConvert.Format,
                releaseDate: banlistToConvert.ReleaseDate,
                bannedCards: _decksDtosFactory.CreateDeckDto(banlistToConvert.ForbiddenCards),
                limitedCards: _decksDtosFactory.CreateDeckDto(banlistToConvert.LimitedCards),
                semiLimitedCards: _decksDtosFactory.CreateDeckDto(banlistToConvert.SemiLimitedCards),
                statistics: _getBanlistStatisticsDtos(banlistToConvert)
                ));
 }
        /// <inheritdoc />
        public DecklistWithStatisticsDTO Convert(Decklist decklist)
        {
            var decklistDto = new DecklistWithStatisticsDTO()
            {
                DecklistId             = decklist.Id,
                WhenDeckWasFirstPlayed = decklist.WhenDecklistWasFirstPlayed,
                Name      = decklist.Name,
                Archetype = decklist.Archetype.Name,
            };

            var decklistStatisticsDtos = new List <DeckStatisticsDTO>();

            foreach (var statistics in decklist.DecklistStatistics)
            {
                decklistStatisticsDtos.Add(
                    new DeckStatisticsDTO()
                {
                    DateWhenDeckWasUsed          = statistics.DateWhenDeckWasUsed,
                    NumberOfTimesWhenDeckWasUsed = statistics.NumberOfTimesWhenDeckWasUsed,
                    NumberOfTimesWhenDeckWon     = statistics.NumberOfTimesWhenDeckWon
                }
                    );
            }

            decklistDto.Statistics = decklistStatisticsDtos;
            decklistDto.MainDeck   = _decksDtosFactory.CreateMainDeckDto(decklist);
            decklistDto.ExtraDeck  = _decksDtosFactory.CreateExtraDeckDto(decklist);
            decklistDto.SideDeck   = _decksDtosFactory.CreateDeckDto(decklist);

            return(decklistDto);
        }
 /// <inheritdoc />
 public ConcreteArchetypeDTO Convert(Archetype archetype)
 {
     return(new ConcreteArchetypeDTO(
                id: archetype.Id,
                name: archetype.Name,
                isPureArchetype: archetype.IsPureArchetype,
                cardsInArchetype: _decksFactory.CreateDeckDto(archetype.Cards),
                statistics: Convert(archetype.Statistics)
                ));
 }