public static ProductRecord GetProduct(int productId) { String query = $"SELECT * FROM products WHERE productId={productId}"; DataTable addresses = connector.ExecuteQuery(query); var record = new ProductRecord(); record.Fill(addresses.Rows[0]); return(record); }
//-------- GET -------- public static List <ProductRecord> GetProducts() { List <ProductRecord> productRecords = new List <ProductRecord>(); String query = "SELECT * FROM products"; DataTable products = connector.ExecuteQuery(query); foreach (DataRow dr in products.Rows) { var record = new ProductRecord(); record.Fill(dr); productRecords.Add(record); } return(productRecords); }