protected SignatureCardViewModel AssignScToScViewModel(SignatureCard entity) { var viewModel = entity.Convert <SignatureCard, SignatureCardViewModel>(); var middleInitial = viewModel.MiddleName == null ? "" : viewModel.MiddleName.Substring(0, 1) + "."; viewModel.FullName = string.Format("{0}, {1} {2}", viewModel.LastName, viewModel.FirstName, middleInitial); return(viewModel); }
/// <summary> /// Sorts through cards and sets converts SignatureCards to the correct type /// </summary> /// <param name="cardSet"></param> /// <returns></returns> private async Task <List <Card> > SetSignatureCardsAsync(List <Card> cardSet) { List <Card> modifiedCards = new List <Card>(cardSet); await Task.Run(() => { foreach (Card gCard in cardSet) { if (gCard is HeroCard) { HeroCard heroCard = gCard as HeroCard; if (gCard.References != null) { foreach (Reference r in gCard.References) { if (r.Type == ReferenceType.Included) { GenericCard g = (GenericCard)modifiedCards.FirstOrDefault(x => x.Id == r.Id); if (g == null) { continue; } modifiedCards.Remove(g); SignatureCard sigCard = new SignatureCard() { HeroId = gCard.Id, //Set the parent card id of the signature card Count = 3, //Signature cards always have x3 of theirselves //g.Amount, Armor = g.Armor, AttackDmg = g.AttackDmg, BaseId = g.BaseId, GoldCost = g.GoldCost, HitPoints = g.HitPoints, Id = g.Id, Illustrator = g.Illustrator, IngameImage = g.IngameImage, IsBlack = g.IsBlack, IsBlue = g.IsBlue, IsGreen = g.IsGreen, IsRed = g.IsRed, FactionColor = g.FactionColor, ItemDef = g.ItemDef, LargeImage = g.LargeImage, ManaCost = g.ManaCost, MiniImage = g.MiniImage, Names = g.Names, Rarity = g.Rarity, References = g.References, SubType = g.SubType, Text = g.Text, Type = g.Type, }; modifiedCards.Add(sigCard); } } } } } }); return(modifiedCards); }