Esempio n. 1
0
        public async Task <IActionResult> Index()
        {
            // Summary
            //
            // Returns list of all projects, consumes internal API

            var vm = await _projectsApi.GetProjectsAsync();

            return(View(vm));
        }
Esempio n. 2
0
        public async Task <IActionResult> Index()
        {
            // Summary
            //
            // Fetch all bugs and projects from Endpoints, render view. Projects are used for display purposes

            var vm = new BugIndexVm
            {
                Bugs     = await _bugsApi.GetBugsAsync(),
                Projects = await _projectsApi.GetProjectsAsync()
            };

            return(View("Index", vm));
        }
Esempio n. 3
0
        public async Task <IActionResult> Index()
        {
            _logger.Log(LogLevel.Information, "Home: Index entered");

            var vm = new HomeIndexVm
            {
                CardCount = _configuration.GetValue <int>("DashboardCardCount"),
                Stacks    = new List <DashboardStack>(),
                Projects  = await _projectsApi.GetProjectsAsync()
            };

            var coloumns = new Dictionary <BugStatus, string>
            {
                { BugStatus.Open, "Open" },
                { BugStatus.Assigned, "In Progress" },
                { BugStatus.Resolved, "Resolved" },
                { BugStatus.Closed, "Closed" }
            };

            var BugsList = await _bugsApi.GetBugsAsync();

            foreach (var pair in coloumns)
            {
                var stack = new DashboardStack
                {
                    AssociatedStatus = pair.Key,
                    Title            = pair.Value
                };

                // Sort Open & In Progress by oldest, resolved & closed by newest
                var bugs = ((pair.Key == BugStatus.Open) || (pair.Key == BugStatus.Assigned))
                    ? BugsList.Where(b => b.Status.HasFlag(pair.Key)).OrderBy(b => b.DateSubmitted)
                    : BugsList.Where(b => b.Status.HasFlag(pair.Key)).OrderByDescending(b => b.DateSubmitted);

                stack.Count = bugs.Count();
                stack.Bugs  = bugs.Take(vm.CardCount).ToList();

                vm.Stacks.Add(stack);
            }

            return(View(vm));
        }