protected void Page_Load(object sender, EventArgs e)
        {
            this.gameBusiness = new GameBussines();

            tbNameProduct.Attributes.Add("placeholder", "Name");
            tbPrice.Attributes.Add("placeholder", "Price");
            LoadImages();
        }
Пример #2
0
        public String games()
        {
            GameBussines gameBussi = new GameBussines();
            var          jsonSeri  = new JavaScriptSerializer();
            var          json      = jsonSeri.Serialize(gameBussi.allGames().ToArray());

            return(json);
        }//games
 protected void ButtonI_Click(object sender, EventArgs e)
 {
     if ((String)typeList.SelectedValue != "0" && (String)consoleList.SelectedValue != "0")
     {
         Game         game         = new Game(tbNameProduct.Text, typeList.SelectedValue, consoleList.SelectedValue, float.Parse(tbPrice.Text));
         GameBussines gameBusiness = new GameBussines();
         gameBusiness.insertGame(game);
     }
 }
        }//insert

        public IHttpActionResult update([FromBody] Game game)
        {
            GameBussines busi = new GameBussines();

            busi.updateGame(game);
            String json = JsonConvert.SerializeObject(game.ToString());

            return(Json(new { Name = game.Name, Price = game.Price, Type = game.Type, Consol = game.Consol }));
        }//insert
        protected void ButtonU_Click(object sender, EventArgs e)
        {
            if ((String)typeListU.SelectedValue != "0" && (String)consoleListU.SelectedValue != "0")
            {
                this.gameBusiness.deleteGame(this.product.IdGame);
                Game         game         = new Game(tbNameProductU.Text, typeListU.SelectedValue, consoleListU.SelectedValue, float.Parse(tbPriceU.Text));
                GameBussines gameBusiness = new GameBussines();
                gameBusiness.insertGame(game);
            }

            Response.Redirect("~/Products/Products.aspx");
        }
 private void charge()
 {
     this.gameBusiness = new GameBussines();
     this.games        = gameBusiness.allGames();
     idGame            = Convert.ToString(Request.QueryString["id"]);
     foreach (Game game in this.games)
     {
         if (this.idGame.Equals(game.IdGame))
         {
             tbNameProductU.Text        = game.Name;
             typeListU.SelectedValue    = game.Type;
             consoleListU.SelectedValue = game.Consol;
             tbPriceU.Text = "" + game.Price;
             product       = game;
         }
     }
 }
        public IHttpActionResult GetGames()
        {
            GameBussines busi = new GameBussines();

            return(Json(busi.allGames().ToArray()));
        }//Get