예제 #1
0
        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;
 }
예제 #6
0
 public void Delete(DataContracts.Category entity)
 {
     _source.RemoveAll(o => o.ID == entity.ID);
 }
예제 #7
0
 public void Insert(DataContracts.Category entity)
 {
     _source.Add(entity);
 }