Exemple #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var category = new Category
            {
                Name  = txtName.Text,
                Title = txtTitle.Text
            };

            CategoryService.AddNewCategory(category);
            UoW.SaveAllChanges();
            Response.Redirect("~/Default.aspx");
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var product = new Product
            {
                Name       = txtName.Text,
                Price      = int.Parse(txtPrice.Text),
                CategoryId = int.Parse(ddlCategories.SelectedItem.Value)
            };

            ProductService.AddNewProduct(product);
            UoW.SaveAllChanges();
            Response.Redirect("~/Default.aspx");
        }