Exemplo n.º 1
0
        public Invoice GetInvoiceByID(int invoice_key)
        {
            Log.Info("Accessing InvoiceBusinessEngine GetInvoiceByID function");
            return(ExecuteFaultHandledOperation(() =>
            {
                var invoice_data = _invoice_repo.GetByID(invoice_key);
                Log.Info("InvoiceBusinessEngine GetByID function completed");

                if (invoice_data.InvoiceKey != 0)
                {
                    var invoice = Map(invoice_data);
                    invoice.Account = _account_be.GetAccountByID(invoice.AccountKey, true);

                    var invoice_items_data = _invoice_item_repo.GetAll(invoice_data);
                    foreach (var inv_item_date in invoice_items_data)
                    {
                        invoice.InvoiceItems.Add(Map(inv_item_date));
                    }

                    invoice.Comments = _comment_be.GetCommentsByEntity(invoice_key, QIQOEntityType.Invoice);
                    return invoice;
                }
                else
                {
                    NotFoundException ex = new NotFoundException(string.Format("Invoice with key {0} is not in database", invoice_key));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }
            }));
        }
        public IEnumerable <InvoiceItemDto> GetAll()
        {
            var result       = _invoiceItemRepository.GetAll();
            var mappedResult = _mapper.Map <IEnumerable <InvoiceItemDto> >(result);

            return(mappedResult);
        }
Exemplo n.º 3
0
 public IActionResult Get()
 {
     return(Ok(Mapper.Map <IEnumerable <InvoiceItemDto> >(repository.GetAll())));
 }
Exemplo n.º 4
0
 public IEnumerable <InvoiceItem> GetAllInvoiceItem()
 {
     return(_invoiceItemRepository.GetAll());
 }