add these routes into your Routes.cs class to support the following urls:

/v1/blogs
/v1/blogs?$orderby=Id
/v1/blogs?$skip=10
/v1/blogs?$format=json
/v1/blogs/{id}
/v1/blogs/{id}/{action}
etc.

                            new HttpRouteDescriptor {
                                                    Name = "blogsmetadata",
                                                    RouteTemplate = "v1/blogs/$metadata",
                                                    Defaults = new { 
                                                            action="GetMetaData", 
                                                            area = "ODataBlog",
                                                            controller = "Blog"
                                                        },
                                                    },
                            new HttpRouteDescriptor {
                                                    Name = "blogsbyidactions",
                                                    RouteTemplate = "v1/blogs/{id}/{action}",
                                                    Defaults = new { 
                                                            action="DefaultActionById",
                                                            area = "ODataBlog",
                                                            controller = "Blog"
                                                        },
                                                    },
                            new HttpRouteDescriptor {
                                                    Name = "blogsbyid",
                                                    RouteTemplate = "v1/blogs/{id}",
                                                    Defaults = new { 
                                                            id = RouteParameter.Optional,
                                                            action="DefaultAction", 
                                                            area = "ODataBlog",
                                                            controller = "Blog"
                                                        },
                                                    }

Last edited Dec 30, 2012 at 9:43 PM by fotisgpap, version 1

Comments

No comments yet.