Exemplo n.º 1
0
        // GET: FinancialOperations
        public ActionResult Index()
        {
            var financialOperationsVm = new FinancialOperationsHistoryViewModel();
            var listOfBankAccounts    = _bankAccountRepository.GetWhere(ba => ba.Id > 0).ToList();

            financialOperationsVm.SelectListOfBankAccounts = new SelectList(listOfBankAccounts, "Id", "AccountName");

            return(View(financialOperationsVm));
        }
Exemplo n.º 2
0
        public ActionResult Details(FinancialOperationsHistoryViewModel model)
        {
            model.ListofFinancialOperation = new List <FinancialOperation>();


            var listOfExpenses = _expensesRepository
                                 .GetWhereWithIncludes(t => t.BankAccountId == model.FinancialOperation.BankAccountId,
                                                       e => e.Category, e => e.SubCategory, e => e.BankAccount);

            listOfExpenses.ForEach(exp => exp.AmountOfMoney         *= (-1));
            listOfExpenses.ForEach(exp => exp.DescriptionOfOperation = @"Category: " + exp.Category.CategoryName + "<br/>" + " SubCategory: " + exp.SubCategory.SubCategoryName);


            var listOfEarnings = _earningsRepository.GetWhereWithIncludes(t =>
                                                                          t.BankAccountId == model.FinancialOperation.BankAccountId, e => e.Category, e => e.SubCategory, e => e.BankAccount);

            listOfEarnings.ForEach(earn => earn.DescriptionOfOperation = @"Category: " + earn.Category.CategoryName + "<br/>" + " SubCategory: " + earn.SubCategory.SubCategoryName);

            var listOfTransferIncomes =
                _transferRepository.GetWhereWithIncludes(t => t.TargetBankAccountId == model.FinancialOperation.BankAccountId, e => e.SourceBankAccount, e => e.TargetBankAccount);

            listOfTransferIncomes.ForEach(transfer =>
            {
                transfer.DescriptionOfOperation = transfer.SourceBankAccount.AccountName;
                transfer.BankAccount            = transfer.TargetBankAccount;
            });



            var listOfTransferOutcomes =
                _transferRepository.GetWhereWithIncludes(t => t.SourceBankAccountId == model.FinancialOperation.BankAccountId, e => e.SourceBankAccount, e => e.TargetBankAccount);

            listOfTransferOutcomes.ForEach(transf =>
            {
                transf.AmountOfMoney         *= (-1);
                transf.DescriptionOfOperation = transf.TargetBankAccount.AccountName;
                transf.BankAccount            = transf.SourceBankAccount;
            });


            model.ListofFinancialOperation.AddRange(listOfEarnings);
            model.ListofFinancialOperation.AddRange(listOfExpenses);
            model.ListofFinancialOperation.AddRange(listOfTransferOutcomes);
            model.ListofFinancialOperation.AddRange(listOfTransferIncomes);


            return(View(model));
        }