Search code examples
odataasp.net-mvc-5

Can´t read odata in mvc controller


I have the following url:

http://localhost:64863/api/Entity/getStatus?%24skip=0&%24top=25&%24inlinecount=allpages&_=1473445898026

My question is how can I read skip and top in controller. This is my controller signature:

[HttpGet("getStatus")]
public JsonResult GetStatus(
    string filter, 
    int skip, 
    int top)
{

Solution

  • This is the code i added after get QueryString:

    private string getParameterFromUrl(string parameter)
            {
                string url = Request.QueryString.Value;
                Match match = Regex.Match(url, parameter + "=([^&]*)");
    
                return match.Result("$1");
            }
    

    Where parameter is skip or top in my case