This is it. The last refactoring chapter. Throughout this book, you refactored an existing codebase from the ground up. We learned about test-driven development, how to write clean code, and tips and tricks for C#. Figure 14.1 shows how far we’ve come on our journey together.
Figure 14.1 In the previous chapters, we implemented the database access, repository, and service layers, and FlightController class. In this chapter, we’ll finish the job and implement the BookingController class.

In this chapter, we’ll implement the last controller: BookingController (section 14.1). After that, we’ll do some manual testing and acceptance testing against the OpenAPI specification from FlyTomorrow. We’ll also set up Swagger middleware to generate an OpenAPI specification on the fly (section 14.2). This is an optional but a very useful technique to know because Swagger helps us with our acceptance testing.