public static InventoryCard AddMagicCardToCollection(MyDbContext context, MagicCard magicCard, CardCollection collection, int insertionIndex = 0) { var inventoryCard = new InventoryCard { DisplayName = magicCard.DisplayName, uuid = magicCard.uuid, multiverseId_Inv = magicCard.multiverseId, CollectionId = collection.Id, InsertionIndex = insertionIndex, Virtual = collection.Virtual }; if (magicCard.isFoilOnly) { inventoryCard.Foil = true; } else { inventoryCard.Foil = false; } if (magicCard.PartB != null) { inventoryCard.PartB_uuid = magicCard.PartB.uuid; } context.Library.Add(inventoryCard); return(inventoryCard); }
public static FullInventoryCard ToFullCard(this InventoryCard inventoryCard, MyDbContext context) { return ((from c in context.LibraryView where c.InventoryId == inventoryCard.InventoryId select c).FirstOrDefault()); }