Summary

Before moving further, let's do a quick recap of what we did throughout this chapter.

We started working on the server-side aspects of our project. Having replaced the fake data provider with a real one, we made good use of it by implementing the Put, Post, and Delete action methods within our .NET Web API Controllers, mapping our Entities to their respective ViewModels--and the other way around--with the help of the Mapster package library. However, we shortly acknowledged the fact that we were writing a lot of duplicate code; in order to reduce this, we implemented a BaseApiController class that we used to do some common and repeating tasks, such as making the DbContext available through dependency injection and providing a handy JsonSettings property. We then derived all our web API controllers from that class and trimmed their source code accordingly.

Right after that, we switched to the client side and implemented the components required to run the new APIs within our Angular app; we started with the QuizEditComponent, on which we put a lot of effort to make it able to spin in two ways--Create mode and Edit mode--so that we could use it to add new quizzes as well as update the existing ones. We also updated the AppModule to add the required references, dependencies, and routes.

After a quick client-server test, we moved to the QuestionListComponent, where we also spent some time to understand the capabilities of the ngOnChanges() life cycle hook and learn how to better use it to suit our present and future needs; then, we switched to the QuestionEditComponent, where we were able to leverage the knowledge previously acquired when working with the quiz counterpart.

From there, it wasn't much more than a walk in the park, as we already knew what to do with the missing Angular components: AnswerListComponent, AnswerEditComponent, ResultListComponent, and ResultEditComponent; although they did have something unique, such as <select> elements and nullable values, implementing these components was mostly an opportunity to retrace our steps and get a good grip on what we previously did.

After all these changes, we felt the urge to do another round of client-server tests; we spent some good time playing with our SPA, adding, updating, and deleting our entities. After all the hardwork, we can definitely say that we did a good job; our application is working fine, and it's already packed with interesting features built upon a consolidated set of client-server interactions. If only the UI wasn't so ugly. Luckily enough, the following chapter will greatly help us overcome that.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.175.253