コード例 #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            int    SellerId    = int.Parse(Session["UserId"].ToString());
            string name        = txtName.Text;
            string URL         = txtURL.Text;
            string description = txtDesc.Text;
            string price       = txtPrice.Text;

            List <Show> Shows = ShowController.GetAllShow();

            bool ShowNameUnique = true;

            foreach (var show in Shows)
            {
                if (name.Equals(show.Name))
                {
                    ShowNameUnique = false;
                }
            }

            string response = "";

            if (ShowNameUnique)
            {
                response = ShowController.CheckAddShow(SellerId, name, URL, description, price);
            }
            else
            {
                response = "Show Name Must be Unique!";
            }

            if (response == "")
            {
                Response.Redirect("../Home/HomePage.aspx");
                return;
            }
            else
            {
                lblError.Text = response;
            }
        }