Beispiel #1
0
        public void DeleteInvoice(Invoice invoice)
        {
            invoice.isDelete = true;
            invoice.UserInvoices.FirstOrDefault().isDelete = true;
            _invoiceRepository.Update(invoice);
            _unitOfWork.Commit();
            int idInvoice = invoice.Id;

            #region [delete]
            var listItemInvoice = _invoiceItemRepository.GetMany(p => p.InvoiceId == idInvoice);
            foreach (var item in listItemInvoice)
            {
                item.Note = "1";
                _invoiceItemRepository.Update(item);
                _unitOfWork.Commit();
            }
            #endregion
            //var listUservoice = _userInvoiceRepository.GetAll().Where(p => p.InvoiceId == idInvoice);
            //foreach (var item in listUservoice)
            //{
            //    item.Note = "1";
            //    _userInvoiceRepository.Update(item);
            //    _unitOfWork.Commit();
            //}
        }