protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int er = 0;

            lblMessage.Text = "";

            if (txtCategory.Text == "")
            {
                er++;
                RequiredFieldValidator1.Text = "Required";
            }
            if (er > 0)
            {
                return;
            }

            DAL.category c = new DAL.category();
            c.Name = txtCategory.Text;

            if (c.Insert())
            {
                lblMessage.Text      = "Data Inserted Successfully!";
                lblMessage.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lblMessage.Text      = c.Error;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Ejemplo n.º 2
0
        private static CategoryDTO getCategoryDTO(DAL.category category)
        {
            CategoryDTO categoryDTO = new CategoryDTO()
            {
                CategoryId   = category.categoryId,
                CategoryName = category.categoryName,
            };

            return(categoryDTO);
        }