Hi,
It looks for me you are calling a WebApi expecting the results ?
1. There is a configuration file within your solution and WEB API request will be redirected to this config file first and decided which controller should be called to serve the request. The file is App_Start\WebApiConfig.cs.
I presume you would not have done any changes to the config file and left with default? If you have left with default then that is fine and if not, we need the current config
2. the ulr you are trying to call
localhost:51525/api/products/GetPromotionTypes
This looks that you have modified the App_Start\WebApiConfig.cs. If you have not modified the url should looks something like
localhost:51525/api/GetPromotionTypes
and this should have a controller and the method
public class GetPromotionTypes : ApiController
{
public IEnemerable<promotiontype> Get()
{
return Utility.GetPromotionTypes();
}
}
By default the APi controller will return the Get() method of the controller when you call like
localhost:51525/api/GetPromotionTypes
Hope this sheds some light and all depends on whether you have modifed the config file or not and my solution above is assuming that you have not modified
UPDATE 2 After further clarification received
1.You may have to change you WebApi Configuration file to reflect the URL you are calling
localhost:51525/api/products/GetPromotionTypes
Please change the configuration file as
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "ProductApi",
routeTemplate: "api/products/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
This tells your server that your API url starts with localhost:51525/api/products
2. Next part of your UR is GetPromotionTypes, this means your WebApi Controller name should be "GetPromotionTypesController" in other words your controller method shoud be
public class GetPromotionTypesController : ApiController
{
public IEnemerable<promotiontype> Get()
{
return Utility.GetPromotionTypes();
}
}
Hope this resoles your problem, if still any issues let me know