Esempio n. 1
0
        // /Home/Index
        public IActionResult Index()
        {
            if (this.IsLoggedIn())
            {
                var submissions = submissionsService.GetAllSubmissions();

                var problems = problemsService.GetProblems()
                               .Select(x => new ProblemViewModel
                {
                    Id    = x.Id,
                    Name  = x.Name,
                    Count = submissions.Where(s => s.ProblemId == x.Id).Count()
                }).ToList();

                return(this.View(new ProblemListViewModel {
                    Problems = problems
                }, "IndexLoggedIn"));
            }
            else
            {
                return(this.View());
            }
        }