public async Task <ActionResult> Index() { //Deserializing the response recieved from web api and storing into the JsonResponseObject JsonResponseListObject lstResponseObject = await webAPIHelper.JsonRestGet <JsonResponseListObject>(szBaseURL, PublicWebApiUrl.API_LIST_OF_BREEDS); // the JsonRestGet could ALSO return an error collection if something went wrong in the API and we could poll that and return an Error view as well. if (!(string.IsNullOrEmpty(lstResponseObject.status)) && lstResponseObject.status.ToUpper() == "SUCCESS") { // Create list of Dog Breeds List <Dog> lstDogs = lstResponseObject.message.Select(p => new Dog() { Breed = p.ToString() }).ToList(); //returning the Breed list to view return(View(lstDogs)); } return(View("Error")); }