Greetings! I am trying to learn WEB MVC in general. I already have Entity Framework background, but I am trying to get back into the web. The sample projects that are available, which include Durandal or Angular, are quite overwhelming for a beginner--so I'm leaving those out and opting for a multi page application. I want to interface with everything in APB... Using the SimpleTaskSystem as a guideline, I am trying to make a MULTI PAGE application. I want to add a controller to list all the Tasks in the SimpleTaskSystem.... but i am absolutely LOST. I have no idea how to call the Application Services created. I don't want to learn Durandal or Angular just yet. Is there a small sample project somewhere that uses the multi-page (non SPA, non Angular, Non Durandal) approach that might be able to help me out?
Or can someone simply show me how I can add a view-only page which calls the GetTasks() method of the TaskAppService in the SimpleTaskSystem sample project. I am quick learn and I hope that if I can get a explanation for this that I will be well on my way.
Thank you
3 Answer(s)
-
0
Hi,
Welcome to ABP :)
As I understand, you don't want to call application service via AJAX. You want a classic MVC solution. There may be different approaches. One could be:
- Create a controller and action (Say TaskController and Index action).
- Inject TaskAppService in this controller and call GetTasks method (with needed parameters) from Index action to obtain list of tasks. It returns a GetTasksOutput object.
- Create a view that has GetTasksOutput as model. From the Index action, pass this GetTasksOutput to this view.
- In the view, just render GetTasksOutput properties using loops and razor syntax.
-
0
Thank you, that may point me in the right direction. The whole injection part is what is really confusing me I guess; I understand it, I'm just not used to it and I think that's what is throwing me off. I will see if I can get anywhere using your advice.
I've tried Googling for a sample project, similar to the ones available, do you happen to know if anything exists like that (even if its not the SimpleTaskSystem sample)?
-
0
Hi again,
I strongly recommend to read Dependency Injection documentation: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection">http://www.aspnetboilerplate.com/Pages/ ... -Injection</a>
Unfortunately, I've not a sample code that I can share here. I will create MPA version of Simple Task System if I can find time for it (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/issues/3">https://github.com/aspnetboilerplate/as ... s/issues/3</a>).
If you try to create some code, we can fix it.