static void Main(string[] args) { string connectionString = ConfigurationManager.ConnectionStrings["Shop"].ConnectionString; CategoryStorage cs = new CategoryStorage(); cs.Connection = new System.Data.SqlClient.SqlConnection(connectionString); //var collection = cs.GetCategory(); //var colllection_ = collection; //foreach (var item in collection) //{ // Console.WriteLine(item.CategoryName); //} cs.Add(new _Category { CategoryName = "Test1" }); cs.Add(new _Category { CategoryName = "Test2" }); cs.Add(new _Category { CategoryName = "Test3" }); cs.Add(new _Category { CategoryName = "Test4" }); //cs.Del(5); //cs.Del(8); }
private void FormAddBtn(object sender, EventArgs e) { string connectionString = ConfigurationManager.ConnectionStrings["Shop"].ConnectionString; CategoryStorage cs = new CategoryStorage(); cs.Connection = new System.Data.SqlClient.SqlConnection(connectionString); var c = cs.Add(new _Category { CategoryName = Form.tbCatName.Text }); GetData(); Form.dGW1.Refresh(); }