Within people, I own the accounts receivable table, where I am calling the page accounts receivable create, and the edit. So far, it's working perfectly.
However, within accounts receivable, I have a select
, where I already wanted to have selected the person I was. And also has the return list.
I needed to know how I can do, for example, by passing a parameter, whether it is being called accounts receivable or people, so in order to return, I do the treatment to know where to return.
Here is the create:
<a asp-page="/ContaReceber/Create" class="btn btn-primary btn-sm">Criar nova Conta</a>
And here's the edit:
<a asp-page="/ContaReceber/Edit" asp-route-id="@item.Id" class="btn btn-sm btn-success">Editar</a>
It redirects, but I need to treat it, just as I did.
This is the person ID parameter that I need to pass to the other page:
<input type="hidden" asp-for="PessoaVM.Pessoas.Id" name="id" id="id" />
Edit: Get pass the id to the AccountReceive / Create page like this:
<a asp-page="/ContaReceber/Create" asp-route-id="@Request.Query["id"]" class="btn btn-primary btn-sm">Criar nova Conta</a>
But I'm not sure how to deal with it here:
public IActionResult OnGet()
{
ContasReceberVM = new ContasReceberViewModel
{
ContasReceber = new ContasReceber(),
PessoaVM = _context.Pessoas.ToList(),
PlanosServicos = _context.PlanosServicos.ToList()
};
return Page();
}
public IActionResult OnGet(int id)
{
ContasReceberVM = new ContasReceberViewModel
{
ContasReceber = new ContasReceber(),
PessoaVM = _context.Pessoas.Where(m => m.Id == id).ToList(),
PlanosServicos = _context.PlanosServicos.ToList()
};
return Page();
}
It returns the following error:
Multiple handlers matched. The following matched route handlers had all the constraints satisfied:
Microsoft.AspNetCore.Mvc.IActionResult OnGet (), Microsoft.AspNetCore.Mvc.IActionResult OnGet (Int32)