// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { Test.UserPrincible = this.User; if (!ModelState.IsValid) { return(Page()); } var createdTestId = await _testRepository.AddTestAsync(Test); return(RedirectToPage("Questions", new { id = createdTestId })); }