Ejemplo n.º 1
0
        public static Deck ConvertFromDeckModelToDeck(DeckModel deckModel)
        {
            ICardDBIF        cardDB    = new CardDB();
            List <CardModel> deckCards = cardDB.GetCardsByDeckId(deckModel.Id);
            Deck             deck      = new Deck()
            {
                Id       = deckModel.Id,
                DeckName = deckModel.DeckName,
                cards    = CardConverter.ConvertFromListOfCardModelToListOfCard(deckCards)
            };

            return(deck);
        }
        public static CGUser convertFromCGUserModelToCGUser(CGUserModel cGUserModel)
        {
            ICardDBIF        cardDB    = new CardDB();
            List <CardModel> userCards = cardDB.GetCardsByUserId(cGUserModel.Id);
            CGUser           cGUser    = new CGUser()
            {
                Id         = cGUserModel.Id,
                UserName   = cGUserModel.UserName,
                Email      = cGUserModel.Email,
                userType   = (CGUser.UserType)cGUserModel.userType,
                userStatus = (CGUser.UserStatus)cGUserModel.userStatus,
                Health     = cGUserModel.Health,
                cards      = CardConverter.ConvertFromListOfCardModelToListOfCard(userCards)
            };

            return(cGUser);
        }