コード例 #1
0
 public void AddClothes(clothes c)
 {
     using (SzafaModel dbconn = new SzafaModel())
     {
         if (!CheckDatabaseExistence(dbconn))
         {
             throw new DbUpdateException();
         }
         dbconn.clothes.Add(c);
         dbconn.SaveChanges();
     }
 }
コード例 #2
0
 public void DeletePieceOfClothing(clothes c)
 {
     using (SzafaModel dbconn = new SzafaModel())
     {
         if (!CheckDatabaseExistence(dbconn))
         {
             throw new DbUpdateException();
         }
         clothes cloth = dbconn.clothes.Find(c.id);
         dbconn.clothes.Remove(cloth);
         dbconn.SaveChanges();
     }
 }
コード例 #3
0
 public void UpdateTypes(types t)
 {
     using (SzafaModel dbconn = new SzafaModel())
     {
         if (!CheckDatabaseExistence(dbconn))
         {
             throw new DbUpdateException();
         }
         types type = dbconn.types.Find(t.id);
         type.name = t.name;
         dbconn.SaveChanges();
     }
 }
コード例 #4
0
 public void UpdateClothes(clothes c)
 {
     using (SzafaModel dbconn = new SzafaModel())
     {
         if (!CheckDatabaseExistence(dbconn))
         {
             throw new DbUpdateException();
         }
         clothes cloth = dbconn.clothes.Find(c.id);
         cloth.description  = c.description;
         cloth.name         = c.name;
         cloth.in_use       = c.in_use;
         cloth.in_use_from  = c.in_use_from;
         cloth.last_time_on = c.last_time_on;
         cloth.picture_path = c.picture_path;
         cloth.times_on     = c.times_on;
         cloth.type_id      = c.type_id;
         dbconn.SaveChanges();
     }
 }