InterviewSolution
Saved Bookmarks
| 1. |
What is the difference between ApiController and Controller? |
|
Answer» APICONTROLLER: It is used to return data that is arranged in series and then sent to the client. public CLASS TweetsController : ApiController{ // GET: /Api/Tweets/ public List<Tweet> Get() { return Twitter.GetTweets(); }}CONTROLLER: It is used to provide normal views. public class TweetsController : Controller { // GET: /Tweets/ [HttpGet] public ACTIONRESULT Index() { return JSON(Twitter.GetTweets(), JsonRequestBehavior.AllowGet); }} |
|