public void AddTransaction(DebtTransactionModel model)
        {
            using (_unitOfWork = DIManager.UnitOfWork)
            {
                ChangeTransactionSumToMainOperationsCurrency(model);

                _unitOfWork.PersonalAccountantContext.Set <debt_Transactions>().Add(new debt_Transactions
                {
                    Date            = model.Date,
                    DebtOperationId = model.OperationId,
                    Sum             = model.Sum
                });
                _unitOfWork.Save();
            }
            using (_unitOfWork = DIManager.UnitOfWork)
            {
                if (isDebtResovled(model.OperationId))
                {
                    _unitOfWork.PersonalAccountantContext.Set <debt_DebtOperations>().FirstOrDefault(x => x.Id == model.OperationId).IsInProgress = false;
                    _unitOfWork.Save();
                }
            }
        }
        private void ChangeTransactionSumToMainOperationsCurrency(DebtTransactionModel model)
        {
            string operationsCurrency = _unitOfWork.PersonalAccountantContext.Set <debt_DebtOperations>().FirstOrDefault(x => x.Id == model.OperationId).Currency.Name;

            model.Sum = _rateScriptor.ChangeBuyRateForCurrency(model.Sum, model.CurrencyName, operationsCurrency);
        }
 public void AddTransction(DebtTransactionModel model)
 {
     _transactionManager.AddTransaction(model);
 }