when i turn it to a Post method all of a sudden i dont get a error 415 anymore Can someone explain why that is and how i can make this work as a Get method since its faster.
The 415 is an unsupported media type. It means the data format you sent to the action was unexpected. I suspect the TokenDto class does not match the data but you did not share the model as requested. I'm not sure why you think a GET is faster than a POST which is not true. Perhaps you mean GET is easier to test with the browser???
Anyway, a POST is the standard for submitting an object. To use a GET, add the data to the URL. I recommend learning GET and POST basics.
"https://localhost:44332/CardCount?acces=" + somevalue
Also this part is not working well:
var count = _dbContext.Cards.Where(x => x.AccesToken == dto.Acces).Count();
it keeps returning 0 while there were 4 items in the "Card" database table with the same Accestoken and the same as the dto.Acces
i have checked it in my database and checked if both Tokens were corrent.
We cannot see your Cards table or the value of dto.Acces. My best guess is dto.Acces does not exist in the table or the table is empty. I recommend running your code though the debugger. You can also use the browser's dev tools to see what values are being submitted to the server.