In a new project I am creating for my work, I am creating a fairly large ASP.NET web API. The API will be in a separate Visual Studio solution that also contains all of my business logic, database interactions, and Model classes.In the test application I am creating (which is ASP.NET MVC4), I want to be able to hit an API URL I defined from the control and cast the return JSON to a Model class. The reason behind this is that I want to take advantage of strongly typing my views to a Model. This is all still in a proof of concept stage, so I have not done any performance testing on it, but I am curious if what I am doing is a good practice, or if I am crazy for even going down this route. Here is the code on the client controller:public class HomeController : Controller{    protected string dashboardUrlBase = http://localhost/webapi/api/StudentDashboard/;    public ActionResult Index() //This view is strongly typed against User    {        //testing against Joe Bob        string adSAMName = jBob;        WebClient client = new WebClient();        string url = dashboardUrlBase + GetUserRecord?userName= + adSAMName;        //'User' is a Model class that I have defined.        User result = JsonConvert.DeserializeObject<User>(client.DownloadString(url));        return View(result);    }. . .}If I choose to go this route, another thing to note is I am loading several partial views in this page (as I will also do in subsequent pages). The partial views are loaded via an $.ajax call that hits this controller and does basically the same thing as the code above:Instantiate a new WebClientDefine the URL to hitDeserialize the result and cast it to a Model ClassSo it is possible (and likely) I could be performing the same actions 4-5 times for a single page. Is there a better method to do this that will:Let me keep strongly typed viewsDo my work on the server rather than on the client (this is just a preference since I can write C# faster than I can write JavaScript)
Consuming an ASP.NET Web API call in an MVC controller
c#;performance;asp.net;web services