RESTful services may or may not be a part of your web application, but we still need to understand how to implement them.
So, now it's time to do some real work. Add ProductController to the project, as well as the following action:
public ActionResult Index()
{
var webClient = new RestSharpWebClient();
var products = webClient.GetProducts();
return View("ProductList", products);
}
Take a look at the preceding code snippet. We have called the GetProducts method of RestSharpWebClient and populated our Index.cshtml view with a complete list of products.
To add another action method, enter the following complete code of our ProductController. The following code snippet contains the Index action method and gives us a list of products:
public class ProductController : Controller
{
public ActionResult Index()
{
var webClient = new RestSharpWebClient...