public static PlayerDataTransferObject CreatePlayerDataTransferObject(Player p) { return(new PlayerDataTransferObject { PlayerSlot = p.PlayerSlot, AccountId = p.AccountId, Item_0 = p.Item_0, Item_1 = p.Item_1, Item_2 = p.Item_2, Item_3 = p.Item_3, Item_4 = p.Item_4, Item_5 = p.Item_5, Backpack_0 = p.Backpack_0, Backpack_1 = p.Backpack_1, Backpack_2 = p.Backpack_2, HeroLevel = p.HeroLevel, Kills = p.Kills, Deaths = p.Deaths, Assists = p.Assists, LastHits = p.LastHits, Denies = p.Denies, GoldPerMin = p.GoldPerMin, XpPerMin = p.XpPerMin, HeroDamage = p.HeroDamage, HeroHealing = p.HeroHealing, TowerDamage = p.TowerDamage, Hero = HeroDataTransferObject.CreateHeroDataTransferObject(p.Hero), Abilities = p.Abilities.Select(a => AbilityDataTransferObject.CreateAbilityDataTransferObject(a)).ToList() }); }
public static HeroDataTransferObject CreateHeroDataTransferObject(Hero hero) { var x = new HeroDataTransferObject { HeroId = hero.HeroId, Name = hero.Name, LocalizedName = hero.LocalizedName, PrimaryAttr = hero.PrimaryAttr, AttackType = hero.AttackType, Legs = hero.Legs, Roles = hero.Roles == null ? new List <string>() : hero.Roles.Select(r => r.Name).ToList() }; return(x); }