public static void PoprawWyrob(wyroby poz) { using (var db = new ecoplastolEntities()) { db.Entry(poz).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public static void DodajWyrob(wyroby poz) { using (var db = new ecoplastolEntities()) { db.wyroby.Add(poz); db.SaveChanges(); } }
public static void UsunWyrob(wyroby poz) { using (var db = new ecoplastolEntities()) { db.wyroby.Attach(poz); db.wyroby.Remove(poz); db.SaveChanges(); } }
public static void UsunWyrobPoID(int id) { using (var db = new ecoplastolEntities()) { wyroby poz = new wyroby(); poz = (from wyr in db.wyroby where wyr.id == id select wyr).FirstOrDefault(); db.wyroby.Attach(poz); db.wyroby.Remove(poz); db.SaveChanges(); } }