public void AddLunchbox(lunchbox l) { try { db.Lunchboxes.Add(l); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void DeleteLunchbox(long lunchBoxId) { try { lunchbox l = FindLunchbox(lunchBoxId); db.Lunchboxes.Remove(l); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void UpdateLunchbox(long lunchBoxId, int quantity) { try { lunchbox l = db.Lunchboxes.Find(lunchBoxId); l.quantity = quantity; db.Entry(l).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } catch (Exception ex) { throw ex; } }