public void Delete(Drink entity) { using (SqlCommand cmd = new SqlCommand("DELETE FROM Drinks where DrinkId = @DrinkId")) { cmd.Parameters.AddWithValue("DrinkId", entity.DrinkId); VTYS.SqlExecuteNonQuery(cmd); } }
public void Add(Drink entity) { using (SqlCommand cmd = new SqlCommand("INSERT INTO Drinks (Name,perPackage,UnitPrice) VALUES (@Name,@perPackage,@UnitPrice)")) { cmd.Parameters.AddWithValue("Name", entity.Name); cmd.Parameters.AddWithValue("perPackage", entity.perPackage); cmd.Parameters.AddWithValue("UnitPrice", entity.UnitPrice); VTYS.SqlExecuteNonQuery(cmd); } }
public void Update(Drink entity) { using (SqlCommand cmd = new SqlCommand("UPDATE Drinks set Name = @Name, perPackage = @perPackage, UnitPrice = @UnitPrice where DrinkId = @DrinkId")) { cmd.Parameters.AddWithValue("DrinkId", entity.DrinkId); cmd.Parameters.AddWithValue("Name", entity.Name); cmd.Parameters.AddWithValue("perPackage", entity.perPackage); cmd.Parameters.AddWithValue("UnitPrice", entity.UnitPrice); VTYS.SqlExecuteNonQuery(cmd); } }