Ejemplo n.º 1
0
        public async Task <IActionResult> OnGet(
            Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            await this.GetContestAsync(
                id.Value);

            this.Learner =
                new ContestLearnerRegistrationAdd
            {
                ContestId = id.Value
            };

            return(Page());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(
            Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                await this.GetContestAsync(
                    id.Value);

                return(Page());
            }

            try
            {
                await _contestLearnerAdder.ExecuteAsync(
                    this.Learner);

                return(RedirectToPage("Details", new { id }));
            }
            catch (Exception)
            {
                ModelState.AddModelError("ProfileLoadError",
                                         $"Couldn't load Profile {this.Learner.UserName}. Make sure you are using just the Profile Name and not email address.");

                await this.GetContestAsync(
                    id.Value);

                this.Learner =
                    new ContestLearnerRegistrationAdd
                {
                    ContestId = id.Value
                };

                return(Page());
            }
        }