public void Update(DataContracts.Product entity) { string query = string.Format("UPDATE PRODUCT SET libelle='{0}', id_category={1} WHERE id={2};", entity.Libelle, entity.IdCategory, entity.ID); using (SqlCommand cmd = AccessBD.Connection.CreateCommand()) { cmd.CommandText = query; cmd.ExecuteNonQuery(); } }
public void Delete(DataContracts.Product entity) { string query = string.Format("DELETE FROM PRODUCT WHERE id={0};", entity.ID); using (SqlCommand cmd = AccessBD.Connection.CreateCommand()) { cmd.CommandText = query; cmd.ExecuteNonQuery(); } }
public void Insert(DataContracts.Product entity) { string query = string.Format("INSERT INTO PRODUCT(libelle, id_category, ean) VALUES('{0}',{1},'{2}');", entity.Libelle, entity.IdCategory, entity.Code); using (SqlCommand cmd = AccessBD.Connection.CreateCommand()) { cmd.CommandText = query; cmd.ExecuteNonQuery(); } }
public void Update(DataContracts.Product entity) { Product prod = _source.First(o => o.ID == entity.ID); if (prod != null) { prod.IdCategory = entity.IdCategory; prod.Libelle = entity.Libelle; } }
private List<Product> MapPRODUCTbo(IDataReader dataReader) { List<Product> list = new List<Product>(); while (dataReader.Read()) { Product product = new Product() { ID = Tools.ChangeType<int>(dataReader["id"]), Libelle = Tools.ChangeType<string>(dataReader["libelle"]), IdCategory = Tools.ChangeType<int>(dataReader["id_category"]), Code = Tools.ChangeType<string>(dataReader["ean"]) }; list.Add(product); } return list; }
public void Delete(DataContracts.Product entity) { _source.RemoveAll(o => o.ID == entity.ID); }
public void Insert(DataContracts.Product entity) { _source.Add(entity); }