Reputation: 77
I am new to Core and razor programming and in my project I have to add a user to the _Context then pass the ID of the added us
_Context.StaffMember.Add(StaffMember);
await _Context.SaveChangesAsync();
Id = StaffMember.UserId;
return RedirectToPage("./Invite", Id);
When I tested the code, I can see the ID correctly, but it is not getting passed to the other page
public async Task<IActionResult> OnGetAsync(int? id){}
and the id is null. I tried the asp-route-id="Model.Id" on the user page, but it is not working.
<input type="submit" value="Add" class="btn btn-primary" asp-route-id="Model.Id"/>
Can anyone help me with this ?
Upvotes: 3
Views: 1061