示例#1
0
 //To Delete the record of a particular employee
 public int DeleteItem(int id)
 {
     try
     {
         InvItem item = db.InvItems.Find(id);
         db.InvItems.Remove(item);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }
示例#2
0
 //To Add new employee record
 public int AddItem(ItemViewModel item)
 {
     try
     {
         var itemNew = new InvItem();
         itemNew.Name       = item.name;
         itemNew.ItemNumber = item.itemNumber;
         itemNew.UnitCost   = item.unitCostID;
         db.InvItems.Add(itemNew);
         db.SaveChanges();
         return(1);
     }
     catch
     {
         throw;
     }
 }