Beispiel #1
0
        // GET: Loan
        public ActionResult Index()
        {
            var loans = loanService.GetLoans();

            return(View(loans));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            // Default Dictionaries
            Dictionary <string, double> dictAccounts = new Dictionary <string, double>()
            {
                { "accounts", 0 }
            };

            ViewBag.PercentageAccounts = dictAccounts;
            Dictionary <string, double> dictTransactions = new Dictionary <string, double>()
            {
                { "transactions", 0 }
            };

            ViewBag.PercentageTransactions = dictTransactions;
            Dictionary <string, double> dictInvoices = new Dictionary <string, double>()
            {
                { "invoices", 0 }
            };

            ViewBag.PercentageInvoices = dictInvoices;

            Dictionary <string, double> dictShares = new Dictionary <string, double>()
            {
                { "shares", 0 }
            };

            ViewBag.PercentageShares = dictShares;

            Dictionary <string, double> dictBrokers = new Dictionary <string, double>()
            {
                { "brokers", 0 }
            };

            ViewBag.PercentageBrokers = dictBrokers;

            /***********************************/
            List <Accounts>    totalAccounts     = serviceAccounts.getAllAccount();
            List <Transaction> totalTransactions = serviceTransactions.GetMany().ToList();
            List <invoice>     totalInvoices     = serviceInvoices.getAllInvoices();
            List <share>       totalShares       = serviceShares.GetAllShares();
            List <broker>      totalBrokers      = serviceBrokers.GetAllBrokers();

            // Totals
            int totalLoans = serviceLoans.GetLoans().Count();

            ViewBag.totalLoans = totalLoans;
            ViewBag.idLastLoan = null;
            if (totalLoans != 0)
            {
                ViewBag.idLastLoan = totalLoans;
            }
            //ViewBag.totalInvoices = serviceInvoices.GetMany().Count();
            ViewBag.totalBrokers = totalBrokers.Count();
            ViewBag.totalShares  = totalShares.Count();

            ViewBag.idLastAccount     = null;
            ViewBag.idLastTransaction = null;


            // Review Last Link && ViewBag(dict<T>)
            if (totalAccounts.Count() != 0)
            {
                ViewBag.idLastAccount = totalAccounts.Last().Id;
                dictAccounts          = getTauxAccounts(totalAccounts);
                if (dictAccounts.Count() != 0)
                {
                    ViewBag.PercentageAccounts = dictAccounts;
                }
            }
            if (totalTransactions.Count() != 0)
            {
                ViewBag.idLastTransaction = totalTransactions.Last().Id;
                dictTransactions          = getTauxTransactions(totalTransactions);
                if (dictTransactions.Count() != 0)
                {
                    ViewBag.PercentageTransactions = dictTransactions;
                }
            }
            // Shares Fill
            if (totalShares.Count() != 0)
            {
                dictShares = getTauxShares(totalShares);
                if (dictShares.Count() != 0)
                {
                    ViewBag.PercentageShares = dictShares;
                }
            }

            // Invoices Fill
            if (totalInvoices.Count() != 0)
            {
                dictInvoices = getTauxInvoices(totalInvoices);
                if (dictInvoices.Count() != 0)
                {
                    ViewBag.PercentageInvoices = dictInvoices;
                }
            }

            // Brokers Fill
            if (totalBrokers.Count() != 0)
            {
                dictBrokers = getTauxBrokers(totalBrokers);
                if (dictBrokers.Count() != 0)
                {
                    ViewBag.PercentageBrokers = dictBrokers;
                }
            }


            /***********************************/
            return(View());
        }