I have an ASP.net Web Application with multiple projects:
- WebApp (Main website with aspx pages)
- Domain (business logic and data access layer)
- Api (webapi project)
I have added reference of Domain in API project, so that i can access the business logic and data layers in API.
Here's my API Class:
public class ShoppingController : ApiController
{
// GET api/shopping/GetShoppingCartItemsCount
public int GetShoppingCartItemsCount()
{
ShoppingCartDetails shopping = new ShoppingCartDetails();
var a = shopping.GetShoppingCart();
if (a != null && a.Count > 0)
return a.Count;
return 0;
}
}
now when i access the above function from my localmachine, localhost/api/shopping/GetShoppingCartItemsCount
it throws resource not found error
can anyone tell me how should i access the above WebAPI from browser?