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