예제 #1
0
 public static void pridejDoDB(Clanky1 cl)
 {
     using (StrankyEntities context = new StrankyEntities())
     {
         context.Clanky1.Add(cl);
         context.SaveChanges();
     }
 }
예제 #2
0
 public static void odeberZDB(int id)
 {
     using (StrankyEntities context = new StrankyEntities())
     {
         Clanky1 clZdb = new Clanky1();
         clZdb = context.Clanky1.FirstOrDefault(c => c.Id == id);
         context.Clanky1.Remove(clZdb);
         context.SaveChanges();
     }
 }
예제 #3
0
 public static void update(Clanky1 cl)
 {
     using (StrankyEntities context = new StrankyEntities())
     {
         Clanky1 clZdb = new Clanky1();
         clZdb       = context.Clanky1.FirstOrDefault(c => c.Id == cl.Id);
         clZdb.Nazev = cl.Nazev;
         clZdb.Text  = cl.Text;
         context.SaveChanges();
     }
 }