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); }
public void DeleteProduct(Product p) { context.Remove(p); context.SaveChanges(); }
public void DeleteProduct(Product product) { _context.Remove(product); _context.SaveChanges(); }
public async Task DeleteProductAsync(Product p) { _context.Remove(p); await _context.SaveChangesAsync(); }