Пример #1
0
        public async Task <IActionResult> CreateCategoriesAndDebits([FromRoute] int id)
        {
            try
            {
                var responseCsv = CSVParserService.ReadCsvFileReturnDebit_Invoice_Amount(Request.Form.Files[0]);

                var debit = new DebitRequestModel()
                {
                    CompanyId = id
                };

                var invoice = new InvoiceRequestModel()
                {
                    CompanyId = id
                };

                using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                {
                    await _invoiceService.CreateAmountInvoice(responseCsv.AmountInvoices, invoice);

                    await _debitService.CreateAmountDebits(responseCsv.AmountDebits, debit);

                    scope.Complete();
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                return(HandleControllerErrors(ex));
            }
        }
Пример #2
0
 static void Main(string[] args)
 {
     var csv = new CSVParserService();
     var xd  = csv.GetMessages();
 }