public override string SelectAction(ODataPath odataPath, HttpControllerContext controllerContext, ILookup<string, HttpActionDescriptor> actionMap) { string result = base.SelectAction(odataPath, controllerContext, actionMap); IDictionary<string, object> conventionStore = controllerContext.Request.ODataProperties().RoutingConventionsStore; if (result != null && conventionStore != null) { conventionStore["keyAsCustomer"] = new BindCustomer { Id = int.Parse((string)controllerContext.RouteData.Values["key"]) }; } return result; }
public override string SelectAction(ODataPath odataPath, HttpControllerContext controllerContext, ILookup <string, HttpActionDescriptor> actionMap) { string result = base.SelectAction(odataPath, controllerContext, actionMap); IDictionary <string, object> conventionStore = controllerContext.Request.ODataProperties().RoutingConventionsStore; if (result != null && conventionStore != null) { conventionStore["keyAsCustomer"] = new BindCustomer { Id = int.Parse((string)controllerContext.RouteData.Values["key"]) }; } return(result); }
public IHttpActionResult Get([FromUri] BindCustomer keyAsCustomer) { if (keyAsCustomer == null) { return(NotFound()); } else if (!ModelState.IsValid) { return(Content(HttpStatusCode.BadRequest, keyAsCustomer)); } else { return(Ok(keyAsCustomer)); } }