Build applications using csharp and asp dotnet - Webbprogrammering/websoft GitHub Wiki
This is the assignment A07 for "Section 07: ASP.NET and Model View Controller (MVC)".
You should save your work in work/s07/console
and work/s07/webapp
.
You have worked though the following articles.
You have visited the lectures to get a brief introduction to the following techniques.
- .NET Core development environment
- C# programming language
- ASP.NET Core framework for web applications
Start by copying example/dotnet/data
to your work/
directory. It contains JSON data that you shall use. The JSON data represents bank accounts.
You should create one console application in work/s07/console
. You should use .NET Core and C#.
You should create one webapp application in work/s07/webapp
. You should use .NET Core, ASP.NET Core, C# and the MVC architectural design pattern.
A pretty formatted text table, in the console app, could look like this.
+--------+---------+-----------+-------+
| Number | Balance | Label | Owner |
+--------+---------+-----------+-------+
| 111111 | 0 | Salary | 11 |
+--------+---------+-----------+-------+
You may restructure or update your JSON file.
-
console
- Create a menu driven console application with the menu choices.
- The user should select what to do and the application should close when the user selects "Exit" from the menu.
- The choice "View accounts" should load the accounts from the JSON file and print out a pretty formatted text table with a header and details of all accounts.
- The choice "View account by number" should ask the user for an id and show the account that matches that id.
-
webapp
- Create a web application that uses your account database.
- Create a page to your application, name it "About" and put some basic text in it, describing this exercise.
- In the Home page, generate a HTML table of all accounts, read data from the json file. Use a Model class for Account and a Service class for the json file reader.
- Add a controller that provides a json response with all accounts, add it to the path
api/accounts
. - Add a controller, to handle the route
api/account/<number>
which shows the account details for that particular account. For example, the pathapi/account/111111
show a json response with all details on that account. Proved an error message, as json, when the account number does not exists. - Update the navigation and add links to all your pages and routes.
-
Do all requirements for grade 3.
-
console
- Add a choice "Search" that ask the user for a search string. Show all accounts that matches that searchstring by its number, full or substring match of label or by its owner.
- Add a choice "move" that moves money (balance) from one account number to another account number. Save the updated JSON file.
-
webapp
- Add a controller that supports moving between two accounts. You may choose to solve this using the rest api or through a html form. Use a POST or PUT method. GET is not the prefered way when updating the state of the web application.
-
Do all requirements for grade 4.
-
console
- Add a choice "New account" that creates a new account. Ask the user for account details. Save the updated JSON file.
- Organise your code in at least one external class in its own file.
-
webapp
- Make it possible to move money between accounts using both a HTML post form and through the JSON REST API. Use controllers and models to separate your code and use Razor for the html form pages. Use POST and PUT as request method.
- Ensure you are reusing your code, avoid duplicate code.