public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { if (curShowDeck) { Destroy(curShowDeck.gameObject); } else { curShowDeck = Instantiate(showDeck, transform.parent); } } }
//Show Deck Detail public ActionResult Show(int?id) { //Debug Purpose to see if we are getting the id Debug.WriteLine("I'm pulling data of " + id.ToString()); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //Query statement to get the specific Deck string query = "SELECT * FROM decks WHERE deckid=@DeckID"; SqlParameter sqlparam = new SqlParameter("@DeckID", id); //Get the Specific Deck Deck selectedDeck = db.Decks.SqlQuery(query, sqlparam).FirstOrDefault(); //Get all the cards that the deck has string aside_query = "SELECT * FROM Cards INNER JOIN DeckCards ON Cards.CardID = DeckCards.Card_CardID WHERE DeckCards.Deck_DeckID=@id ORDER BY Quantity DESC"; var fk_parameter = new SqlParameter("@id", id); List <Card> cards = db.Cards.SqlQuery(aside_query, fk_parameter).ToList(); //Get the Quantity Amount aside_query = "SELECT quantity FROM Cards INNER JOIN DeckCards ON Cards.CardID = DeckCards.Card_CardID WHERE DeckCards.Deck_DeckID=@id ORDER BY Quantity DESC"; fk_parameter = new SqlParameter("@id", id); List <int> quantities = db.Database.SqlQuery <int>(aside_query, fk_parameter).ToList(); //Get all cards List <Card> allCards = db.Cards.SqlQuery("SELECT * FROM Cards").ToList(); //ViewModel for the ShowDeck ShowDeck viewModel = new ShowDeck(); viewModel.deck = selectedDeck; viewModel.cards = cards; viewModel.cardQuantity = quantities; viewModel.allCards = allCards; if (selectedDeck == null) { return(HttpNotFound()); } //Show the result return(View(viewModel)); }