public void DeleteItem(string id)
        {
            Items item = _context.Items.Find(id);

            _context.Remove(item);
            _context.SaveChanges();
        }
        public void Delete(string obj)
        {
            Orders r = _context.Orders.Find(obj);

            _context.Remove(r);
            _context.SaveChanges();
        }
        public void DeleteOrder(string id)
        {
            Orders order = _context.Orders.Find(id);

            _context.Remove(order);
            _context.SaveChanges();
        }
예제 #4
0
        public void Delete(int id)
        {
            Orders o = _context.Orders.Find(id);

            _context.Remove(o);
            _context.SaveChanges();
        }
예제 #5
0
        public IActionResult DeleteItem(PurchasedItems item)
        {
            ShopDBContext  db            = new ShopDBContext();
            Users          user          = new Users();
            Items          iteminfo      = new Items();
            PurchasedItems returningItem = new PurchasedItems();

            foreach (PurchasedItems i in db.PurchasedItems)
            {
                if (i.Id == item.Id)
                {
                    returningItem = i;
                }
            }
            if (returningItem.ItemType != null)
            {
                foreach (Users u in db.Users)
                {
                    if (returningItem.UserId == u.Id)
                    {
                        user = u;
                    }
                }
                foreach (Items price in db.Items)
                {
                    if (returningItem.ProductName == price.ProductName)
                    {
                        iteminfo = price;
                    }
                }

                user.Funds        += iteminfo.Price;
                iteminfo.Quantity += 1;
                if (returningItem.Quantity == 1)
                {
                    db.Remove(returningItem);
                }
                else
                {
                    returningItem.Quantity -= 1;
                }

                db.SaveChanges();
                return(List());
            }
            else
            {
                return(List());
            }
        }
예제 #6
0
 public void DeleteOrders(string id)
 {
     _context.Remove(id);
     _context.SaveChanges();
 }