I have a service in the form :
[HttpGet]
public string GetProductCode(Products product, SubProducts subProduct)
Where the 2 values being passed are an enum value. How should I consume this and how do I get the returned value?
You can add the following in your WebApiConfig file:
config.Routes.MapHttpRoute(
name: "ProductCodeRoute",
routeTemplate: "api/YourControllerName/{product}/{subProduct}"
);
So that clients can call the service at: //Url/YourControllerName/1/2
to get the product code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.