public void Delete(Warehouse item)
        {
            var query = (from d in _context.Warehouses
                         where d.Warehouseid == item.Warehouseid
                         select d).FirstOrDefault();

            _context.Warehouses.Remove(query);
            _context.SaveChanges();
        }
 public void Update(Warehouse item)
 {
     for (int i = 0; i < _warehouses.Count; i++)
     {
         if (_warehouses[i].Warehouseid == item.Warehouseid)
         {
             _warehouses[i] = item;
         }
     }
 }
 public void Delete(Warehouse item)
 {
     for (int i = 0; i < _warehouses.Count; i++)
     {
         if (_warehouses[i].Warehouseid == item.Warehouseid)
         {
             _warehouses.RemoveAt(i);
         }
     }
 }
        public void Update(Warehouse item)
        {
            //Package updateitem = _context.Packages.First(i => i.PackageID == item.PackageID);
            var query = (from d in _context.Warehouses
                         where d.Warehouseid == item.Warehouseid
                         select d).FirstOrDefault();

            query.Warehouseid = item.Warehouseid;
            query.X = item.X;
            query.Y = item.Y;

            //_context.Packages.Attach(item);
            //_context.Entry(item).State = EntityState.Modified;
            //_context.Entry(query).CurrentValues.SetValues(item);
            _context.SaveChanges();
        }
 public void Add(Warehouse item)
 {
     _warehouses.Add(item);
 }
 public void Add(Warehouse item)
 {
     _context.Warehouses.Add(item);
     _context.SaveChanges();
 }