Ejemplo n.º 1
0
        public void Transfer(TransferToSaveDto transferData, int propertyId)
        {
            var creditCategory = _categoryRepository.GetCreditTransferCategory(propertyId);
            var debitCategory = _categoryRepository.GetDebitTransferCategory(propertyId);
            var originAccount = _accountRepository.Get(transferData.OriginAccountId);
            var destinyAccount = _accountRepository.Get((transferData.DestinyAccountId));
            var property = _propertyRepository.Get(propertyId);

            var creditTransaction = new Transaction(transferData.Value, transferData.Date.ToDate(), creditCategory, transferData.Description, destinyAccount, property);
            var debitTransaction = new Transaction(transferData.Value, transferData.Date.ToDate(), debitCategory, transferData.Description, originAccount, property);

            _transactionRepository.Add(creditTransaction);
            _transactionRepository.Add(debitTransaction);
        }
Ejemplo n.º 2
0
        public ActionResult Transfer(TransferToSaveDto transferData, string novo)
        {
            _transactionApp.Transfer(transferData, SeletedPropertyId);

            return RedirectToAction(string.IsNullOrEmpty(novo) ? "Index" : "Transfer");
        }