public async Task <ImportOrder> Delete(int?Id)
        {
            var orderToRemove = await _context.ImportOrders
                                .Include(io => io.ImportedProducts)
                                .ThenInclude(ip => ip.Product)
                                .FirstOrDefaultAsync(o => o.ID == Id);

            if (orderToRemove != null)
            {
                _context.Remove(orderToRemove);
            }
            await _context.SaveChangesAsync();

            return(orderToRemove);
        }
Esempio n. 2
0
 public void DeleteProduct(Product p)
 {
     context.Remove(p);
     context.SaveChanges();
 }
Esempio n. 3
0
 public void DeleteProduct(Product product)
 {
     _context.Remove(product);
     _context.SaveChanges();
 }
 public async Task DeleteProductAsync(Product p)
 {
     _context.Remove(p);
     await _context.SaveChangesAsync();
 }