Sjyjahqvfbkg
New Member
I'm trying to build my first enterprise ASP.NET MVC 4 web application, and I'm having some issues figuring out the correct flow of things.Let's say I have a view Clients.cshtml, which has the corresponding ClientsController, base class \[code\]Controller\[/code\].I want the Clients view to display a list of all clients in the system.Because of Separation of Concerns, I believe the correct place to handle such a request would be an \[code\]ApiController\[/code\], not the \[code\]Controller\[/code\] itself, which I believe should be more or less restricted to UI tasks. So, I add the method \[code\]getClients()\[/code\] in the \[code\]ApiController\[/code\] which will return a JSON object containing all the clients.Now, how do I consume this from my View, or my \[code\]Controller\[/code\]?A way, I believe, would be handling it using javascript; when the View is loaded, I call the \[code\]ApiController\[/code\] using \[code\]jQuery\[/code\] and such, and display the results asynchronically.But I am not sure this is the correct approach, is it? I believe it is one approach, but I'd like to know alternatives, or better (more conventional) ways of handling this.Thank you