Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try {
                string name  = txtName.Text;
                string type  = txtType.Text;
                double price = Convert.ToDouble(txtPrice.Text);
                price = price / 100;
                string roast   = txtRoast.Text;
                string country = txtCountry.Text;
                string image   = "../Images/Coffee/" + ddlImage.SelectedValue;
                string review  = txtReview.Text;

                var coffee = new AspWebFormsWebshop.Repository.Entites.Coffee(-1, name, type, price, roast, country, image, review);
                ConnectionClass.AddCoffee(coffee);
                lblResult.Text = "Upload succesful!";
                ClearTextFields();
            } catch (Exception) {
                lblResult.Text = "Upload failed!";
            }
        }