Ejemplo n.º 1
0
        public override bool Delete(Guid id)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentException("invoice id cannot be empty");
            }

            var invoice = Persistor.Get(id);

            // verify that the invoice dosen't have any payments
            // we can't delete invoices that have payments
            if (invoice.Payments != null && invoice.Payments.Count > 0)
            {
                throw new NotImplementedException("an invoice that contains a payment can not be deleted");
            }

            Persistor.Delete(id);
            return(Persistor.Commit() > 0);
        }