Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to make HttpGet accept an incoming ViewModel

$
0
0

I've been messing around with a web api, but I need a GET method that reads an incoming dto so it can use multiple parameters in its search. Basically something like this:

[HttpGet("{AccountDTO}")]
public string Get(AccountDTO dto)
{
     // Parse the dto, then do stuff
     return "Hit it";
}

Anyone know how to do this? The DTO has four properties, so I thought it would work just calling

http://localhost:52743/api/accounts/?AccountNumber=123456&AccountName=DEV&BrokerName=Test&Symbol=GBPUSD

It does not... Any links to tutorials are greatly appreciated as the official one is still rather thin.

TIA!

Dennis


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>