To delete profile
To delete profile

Reputation: 382

ASP.net MVC oData route with parameters

Is it possible to use addresses like that :

http://community.innovacall.local/odata/contactcompetencies(id=GetById/4a50412c-4e36-468a-b7d1-a36a78f02b02)?%24inlinecount=allpages&%24top=10

I handmade a workaround for the second one but I'm sure there is a out of the box solution.

Guid userId = Guid.Parse(Request.Properties["MS_ODataPath"].ToString().Split('(')[1].Split(')')[0].Split('=')[1]);

Could you help me to find it ?

Upvotes: 0

Views: 858

Answers (1)

qujck
qujck

Reputation: 14580

Use & to separate query string options

Use $filter to filter the data (see here):

community.innovacall.local/odata/contactcompetencies?$filter=id eq 1

Use guid'<value>' for guids (see here)

community.innovacall.local/odata/contactcompetencies?$filter=id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'

Use $inlinecount=allpages to get a count of records (see here)

community.innovacall.local/odata/contactcompetencies?$filter=id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'&$inlinecount=allpages

Use $top and $skip to page through the results (see here and here)

community.innovacall.local/odata/contactcompetencies?$filter=id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'&$inlinecount=allpages&$top=10&$skip=10

Upvotes: 1

Related Questions