Updated editPurchase to delete the purchase if the quantity is 0 instead of updating it.