public void SupplierIdAndProduct_DeleteProduct_DetachProductFromSupplier() { const int supplierId = 7; var product = new Product(); _supplierService.DeleteEntity(supplierId, product); Assert.Null(product.SupplierId); }
public async Task <ActionResult> DeleteSupplierProduct(int supplierId, int productId) { await DoesSupplierExist(supplierId); var existingProduct = await GetProduct(supplierId, productId); _supplierService.DeleteEntity(supplierId, existingProduct); if (await _supplierService.IsSavedToDb()) { return(Ok($"Product with id '{productId}' of supplier " + $"with id {supplierId} has been deleted")); } return(BadRequest()); }