C
C#15mo ago
batsky

I can't transfer data from controller to query file

Stack Overflow
I can't transfer data from controller to query file
Hello I can get every data but I can't get the ProductIds, it gives me null in the Handle functions request parameter. SelectedIds is not null, I can get it without problem in my action. I hope som...
14 Replies
Tvde1
Tvde115mo ago
It's really not clear what your question/problem is Is MediatR relevant to the question btw? We can't really tell if you put a breakpoint in EmployeeSessionPost. Is selectedIds null?
batsky
batsky15mo ago
as I mentioned in the post, I don't get selectedIds null, I can get my data. I mentioned everything necessary. Mediatr is not relevant the question. I can declare other variables without problem. Only the ProductIds is become null in the handle function. I couln't find anything in debugging
Tvde1
Tvde115mo ago
That would mean MediatR is malfunctioning right? You give it a Query with a list of ints, and the Handle method doesn't receive the list of ints?
batsky
batsky15mo ago
I tought the same but in all of the other areas in the project, mediatr is working fine also in here as well, because I can retrieve the other datas Yes ProductIds is null in handle
Tvde1
Tvde115mo ago
I think it's unlikely too. Try debugging again to make really sure
batsky
batsky15mo ago
when I get in here selectedIds become null as well
batsky
batsky15mo ago
I see it now but I can get the data when I trigger the action, it is reachable
batsky
batsky15mo ago
here as you can see
Tvde1
Tvde115mo ago
and the 2nd time, does the query get the selected ids?
batsky
batsky15mo ago
ow okay I see I noticed now, my action getting triger twice don't know why, I will check. After the second trigger It makes the selectedIds = 0 Hey, I edited my stackoverflow link. Can you check it one more time. Here is the result of all my debugging I hope you can help
Tvde1
Tvde115mo ago
your <form> has an action which posts to your endpoint, but also $('#btnUpdate').on('click' posts to your endpoint I think both these things are making a separate call find out which one is the one that works and remove the other :)
batsky
batsky15mo ago
Yeah, I was thinking the same but without using EmployeeSessionPost as action parameter I can't get the data I can't make it POST request without not using any button. So I had to have the button. But also I can't get the data without the EmployeeSessionPost, without using it in the UrlAction
Tvde1
Tvde115mo ago
hmm I don't know which one to keep and which one to throw away. I haven't used razor in a while
batsky
batsky15mo ago
hmm okay I understand I fixed the problem if you interest you can check it from the given stackoverflow link