public void deleteitem(int id, record r) { using (var db = new LabStorageEntities()) { db.records.Remove(db.records.Where(s => s.id == id).FirstOrDefault()); db.SaveChanges(); } }
public bool additem(record r) { bool status = false; using (var db = new LabStorageEntities()) { db.records.Add(r); db.SaveChanges(); status = true; return(status); } }
public void modifyitem(int id, record r) { List <record> l = new List <record>(); using (var db = new LabStorageEntities()) { l = db.records.ToList(); foreach (var item in l) { if (item.id == id) { item.category = r.category; item.itemname = r.itemname; item.noofitems = r.noofitems; } } db.SaveChanges(); } }