Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
        public bool additem(record r)
        {
            bool status = false;

            using (var db = new LabStorageEntities())
            {
                db.records.Add(r);
                db.SaveChanges();
                status = true;
                return(status);
            }
        }
Esempio n. 3
0
        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();
            }
        }