Lesson 39. Capstone 7

 

In this capstone exercise, you’ll apply the lessons you’ve learned in this Web Programming unit to the Bank Accounts solution that you’ve been working on throughout the book. Start in src/code-listings/lesson-39.

39.1. Defining the problem

In this capstone, you’ll first make your application web-enabled: you’ll add a Web API layer on top, before consuming it via a script over HTTP. You’ll also learn how to make your WPF application work over HTTP. Finally, you’ll make your bank account use asynchronous data access.

39.1.1. Solution overview

At the end of the preceding capstone, you replaced the filesystem with a SQL database for storing transactions, along with a WPF application for the GUI. In this lesson, I’ve removed the GUI element completely (don’t worry, you could plug it back in again without too much difficulty) as well as the database project (the schema hasn’t changed at all). What I’ve introduced instead is an ASP .NET Web API project that you’ll use to provide an API for the bank application. I’ve done all of the work to add the correct NuGet packages and set up the binding redirects already, so you can focus on the application coding.

39.2. Adding Web API support to your application

Start by making a controller for the bank account application. It should have endpoints reflecting the different functions exposed by the BankAPI interface—getting details on an account, getting the transaction history, withdrawing funds, and depositing funds.

39.3. Consuming data with Swagger

39.4. Enriching the API

Summary