Example #1
0
        // GET: App/SponsorTransaction/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var sponsorTransaction = await sponsors.GetTransactionByIdAsync(id.Value);

            if (sponsorTransaction == null)
            {
                return(NotFound());
            }
            ViewData["SponsorID"] = new SelectList(await sponsors.GetAllAsync(), "SponsorID", "Name", sponsorTransaction.SponsorID);
            return(View(sponsorTransaction));
        }
Example #2
0
        public async Task <IViewComponentResult> InvokeAsync(string Mode = "Default")
        {
            var spnsrs = await sponsors.GetAllAsync();

            if (Mode == "Tops")
            {
                var temp = new List <Tuple <Sponsor, double> >();
                foreach (Sponsor spnsr in spnsrs)
                {
                    double sumAmounts = await sponsors.GetSumOfAmountsAsync(spnsr);

                    temp.Add(new Tuple <Sponsor, double>(spnsr, sumAmounts));
                }

                temp.Sort(delegate(Tuple <Sponsor, double> x, Tuple <Sponsor, double> y)
                {
                    return(x.Item2 > y.Item2 ? -1 : 1);
                });

                spnsrs          = temp.Select(x => x.Item1).Take(5);
                ViewBag.Amounts = temp.Select(x => x.Item2).Take(5).ToList();
            }

            return(View(Mode, spnsrs));
        }
Example #3
0
 // GET: App/Sponsor
 public async Task <IActionResult> Index()
 {
     return(View(await sponsors.GetAllAsync()));
 }