public async Task <IActionResult> Delete(int basketID, int furnitureID)
        {
            var basket = await _context.Basket.FirstOrDefaultAsync(item => item.BasketID == basketID && item.FurnitureID == furnitureID);

            _context.Basket.Remove(basket);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Example #2
0
 //create basket and add it to the database then save changes
 public async Task CreateBasket(Basket basket)
 {
     _context.Basket.Add(basket);
     await _context.SaveChangesAsync();
 }