public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { } else { try { Userid = await _usersServices.CreateUseres(User); if (User == null) { return(RedirectToPage("../Error")); } else { return(RedirectToPage("UserPage", new { userid = User.UserId })); } } catch (Exception) { return(RedirectToPage("../Error")); } } return(Page()); }