There are two page one is Edit page and the other is Main Detail page which is combined data of some entities In edit page : after edit done and I posted the data to API as below
public async Task<IActionResult> OnPostAsync(Guid id)
{
ManufacturerAuthorizedPerson.Id = id;
ManufacturerAuthorizedPerson.ManufacturerId = GetManufacturerId(id);
if (!ModelState.IsValid)
{
await OnGetAsync(id);
return Page();
}
HttpResponseMessage = await httpSystemApi.PutAsync("ManufacturerAuthorizedPersons", ManufacturerAuthorizedPerson);
if (HttpResponseMessage.IsSuccessStatusCode)
{
return RedirectToPage("../Detail", ManufacturerAuthorizedPerson.ManufacturerId);
}
else
{
await OnGetAsync(id);
return Page();
}
}
The ID in OnPostMethod(Guid id) is the value of edited entity. I am using the value and get the other one to use in route as below to get detail page.
ManufacturerAuthorizedPerson.ManufacturerId = GetManufacturerId(id);
but on the detail page the value coming from route ID that I sent from Edit pages post method like below
return RedirectToPage("../Detail", ManufacturerAuthorizedPerson.ManufacturerId);
do not show up as route URL.Instead of ID is beeing same as I wa sent to Edit Page. Little bit confused. Need help please.
Suddenly I have found simpe solution to this problem. You should type:
return RedirectToPage("../Detail", new {id = ManufacturerAuthorizedPerson.ManufacturerId});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With