Пример #1
0
        public async Task <IViewComponentResult> InvokeAsync(string Mode = "Default")
        {
            var cllgs = await colleages.GetAllAsync();

            if (Mode == "Tops")
            {
                var temp = new List <Tuple <Colleague, double> >();
                foreach (Colleague cllg in cllgs)
                {
                    double sumAmounts = await colleages.GetSumOfAmountsAsync(cllg);

                    temp.Add(new Tuple <Colleague, double>(cllg, sumAmounts));
                }

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

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

            return(View(Mode, cllgs));
        }
 public async Task <IViewComponentResult> InvokeAsync()
 {
     ViewData["ColleagueID"] = new SelectList(await colleagues.GetAllAsync(), "ColleagueID", "Name");
     return(View());
 }
Пример #3
0
 // GET: App/Sponsor/Create
 public async Task <IActionResult> Create()
 {
     ViewData["ColleagueID"] = new SelectList(await colleagues.GetAllAsync(), "ColleagueID", "Name");
     return(View());
 }