Exemplo n.º 1
0
        public IActionResult Details(string id)
        {
            var submission = problemsService.GetSubmission(id);

            var allSubmissions = new List <SubmissionViewModel>();

            foreach (var currSubmission in submission.Problem.Submissions)
            {
                allSubmissions.Add(new SubmissionViewModel()
                {
                    AchievedResult = currSubmission.AchievedResult,
                    CreatedOn      = currSubmission.CreatedOn.ToString(),
                    MaxPoints      = currSubmission.Problem.Points,
                    SubmissionId   = currSubmission.Id,
                    Username       = currSubmission.User.Username
                });
            }

            var viewmodel = new ProblemDetailsViewModel
            {
                Id          = id,
                Name        = this.submissionsService.GetProblemName(id),
                Submissions = allSubmissions
            };

            return(this.View(viewmodel));
        }