Пример #1
0
        // GET: Earnings
        public ActionResult Index()
        {
            var earningVm = new EarningViewModel();

            earningVm.ListOfEarnings = _earningsRepository.GetWhereWithIncludes(x => x.Id > 0, x => x.BankAccount, x => x.SubCategory, x => x.Category).ToList();
            return(View(earningVm));
        }
Пример #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));
        }