I've already setup all the JSON readers. The issue is just that I can't pull say the Category Name / Patent Number from reading throug the categorypatent table.
So the real question is that since my CategoryPatent model is setup with 2 virtuals to my Category / Patent models is it possible to pull the specific field elements by just using the CategoryPatent model or do I need to do more work to pass back those values?
There is no View method in Web API. You need learn more about Web API. See, this
article.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Yes I know there are no views in web API, that was just to show what was in my controller. I'm just wonder if there is a way or not to access model information from another model with web api's like how it's d one within a controller with the .include().
Yes I know there are no views in web API, that was just to show what was in my controller. I'm just wonder if there is a way or not to access model information from another model with web api's like how it's d one within a controller with the .include().
The DbContext class is same in Web APi and MVC.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Then why is it not possible to use it in the same contest that I'm using in my controller to get the name and number? --> db.CategoryPatents.Include(c => c.Category).Include(c => c.Patent);
Then why is it not possible to use it in the same contest that I'm using in my controller to get the name and number? --> db.CategoryPatents.Include(c => c.Category).Include(c => c.Patent);
Can you provide a sample application?
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
MasterV23
Member
113 Points
318 Posts
Re: Setting up web api to pull data from a database using EF.
Apr 20, 2012 05:49 PM|LINK
I've already setup all the JSON readers. The issue is just that I can't pull say the Category Name / Patent Number from reading throug the categorypatent table.
MasterV23
Member
113 Points
318 Posts
Re: Setting up web api to pull data from a database using EF.
Apr 20, 2012 07:21 PM|LINK
So the real question is that since my CategoryPatent model is setup with 2 virtuals to my Category / Patent models is it possible to pull the specific field elements by just using the CategoryPatent model or do I need to do more work to pass back those values?
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Setting up web api to pull data from a database using EF.
Apr 21, 2012 01:54 PM|LINK
There is no View method in Web API. You need learn more about Web API. See, this article.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
MasterV23
Member
113 Points
318 Posts
Re: Setting up web api to pull data from a database using EF.
Apr 22, 2012 02:35 AM|LINK
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Setting up web api to pull data from a database using EF.
Apr 22, 2012 02:54 AM|LINK
The DbContext class is same in Web APi and MVC.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
MasterV23
Member
113 Points
318 Posts
Re: Setting up web api to pull data from a database using EF.
Apr 22, 2012 01:58 PM|LINK
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Setting up web api to pull data from a database using EF.
Apr 22, 2012 05:18 PM|LINK
Can you provide a sample application?
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD