protected void Button1_Click(object sender, EventArgs e) { String name = TextBox1.Text.Trim(); using (LiBoClothesShopEntities context = new LiBoClothesShopEntities()) { Brand newBrand = new Brand() { Name = name }; context.AddToBrands(newBrand); context.SaveChanges(); Response.Redirect("~/Default.aspx"); } }
/// <summary> /// Create a new Brand object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> public static Brand CreateBrand(global::System.Int32 id, global::System.String name) { Brand brand = new Brand(); brand.Id = id; brand.Name = name; return brand; }
/// <summary> /// Deprecated Method for adding a new object to the Brands EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBrands(Brand brand) { base.AddObject("Brands", brand); }