public IActionResult GetContabilize(AsientosDTO asientos) { try { if (asientos == null) { return(StatusCode(400, new { ErrorMessage = "Object is Null" })); } return(StatusCode(200, _handler.Contabilize(asientos, _postEntriesService))); } catch (Exception e) { return(StatusCode(500, e.Message)); } finally { _unitOfWork.Dispose(); } }
public dynamic Contabilize(AsientosDTO data, IPostEntriesService postEntriesService) { var accountingEntryDebit = new { data.description, auxiliaryAccountId = 8, account = "80", movementType = 1, period = DateTime.UtcNow.AddMinutes(-240), data.amount, currencyTypeId = 1 }; var accountingEntryCredit = new { data.description, auxiliaryAccountId = 8, account = "4", movementType = 1, period = DateTime.UtcNow.AddMinutes(-240), data.amount, currencyTypeId = 1 }; var Json = new { accountingEntryDebit, accountingEntryCredit }; var result = postEntriesService.PostEntries(Json); _unitOfWork.PurchaseOrder.desactivatePurchases(data.purchaseOrders); _unitOfWork.Complete(); return(result); }