Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possible to provide some services to other MVC4 internet application from Myown MVC4 application.
Posted

1 solution

SQL
If main application provides  OData then we can use it anywhere in else application

The Open Data Protocol (OData) is a data access protocol for the web. OData provides a uniform way to query and manipulate data sets through CRUD operations (create, read, update, and delete).


Your MVC Action method should be like this

[Queryable(ResultLimit = 10)]
public IQueryable<service> Get()
{
return new Service[]
{
new Service { Id = 1, Description = "This is my service 1." },
new Service {Id = 2, Description = "This is my service 2."},
new Service {Id = 3, Description = "This is my service 3."}
}.AsQueryable();
}


Now you can request it like this ‘request to /api/service?$top=2’

And you will get json response like this

{ { "Id": "1", "Description": "This is my service 1."}, { "Id": "2", "Description": "This is my service 2."}}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900