ASP.NET代写:CS4112 MVC Basics

Requirement

这次作业是用ASP.NET代写一个网站,作业给了Tutorial,属于一个繁琐的工程性质的作业。

In this assignment, you are working on a site for a town’s bus service. You need to create the database from a script, generate the models and create views to display and maintain the busRoute & busStop tables. In this assignment and all subsequent assignments, whenever you see “XX”, replace it with your initials.

XXBusService project

  1. Create an ASP.NET Core project based on .NET Core and using the MVC technique. Call it XXBusService (where XX are your initials).
  2. Load the database to SQL, then generate the models & context for Entity Framework:
    • a. Download the BusService.sql database script from the course site
    • b. Use SQL Server Management Studio Express to execute the script and build the database.
    • c. Generate the Entity Framework classes for the database in the project’s Models folder. Name the context BusServiceContext.
    • d. Add the connection string to appsettings.json, add a service to Startup.cs to support dependency injection for the context, and add a constructor in the context to load the connection string via a DbContextOptions collection.
    • e. Be nice and I’ll do all this for you on the exams.
  3. Modify the default layout’s footer:
    • a. Put your name and section on the left side of the footer. Your name should be a hyperlink causing the user’s e-mail client to create an email to your college e-mail account.
    • b. Move the menu’s hyperlinks for “About” and “Contact” to the right side of the footer, retaining the horizontal alignment.

XXBusRouteController

  1. Generate a controller called XXBusRouteController along with the required Views to enable full CRUD maintenance on the busRoute table. Add a link to it on the menu.
    • a. Ensure all views & hyperlinks function correctly:
    • i. Index, Details and Delete views should show the bus route code and the route name
    • ii. Create should allow the user to specify the busRouteCode
    • iii. Edit should display the busRouteCode but not permit the user to change it. Watch this. Edit still needs to work afterwards!
    • b. Change the browser window title and the heading on the Index view to “Bus Route Listing” instead of “Index”. Less generated-code ambiguity for the user this way.

XXBusStopController

  1. Generate a controller called XXBusStopController along with the required Views to enable full CRUD maintenance on the busStop table. Add a link to this controller to the menu.
    • a. The key, busStopNumber, is manually entered (and displayed at the stops). It should be displayed on all Views, but only be touched on the Create View.
    • b. You need to calculate a hash value for the location name before writing the record out in Edit and Create. I’d suggest a method that sums the byte value of each letter in the stop’s location field. It should produce the same value for “Cedar/King” and “King/Cedar” … meaning these two stops are for the same intersection … one travelling on Cedar approaching King, and the other travelling on King approaching Cedar.
    • i. Do not permit the user to enter the locationHash value on Create or Edit, but you can show them the current value on Edit, if you like.
  2. Ensure the controllers (and their menu entries) both work.I certainly will check.
    Both Controllers
  3. Comments are required to describe what the program does and what each of the actions do. Generated controllers have 9 methods/actions: at 1% penalty each, that’s a 10% loss for each controller … two controllers in the assignment … get the picture? Max standards penalty in two programs. Uh … what did you call the field accumulating the hash value … did you use full words and Camel notation?

Hand In

  1. Zip and upload your project folder to the D2L Drop-Box (course tools assignments) for this assignment.
  2. If submitting during the class period, print and hand in the marking sheet (Content assignments) with your name on it. Outside of class, add the CP2A Cover Sheet (Content Class Rules), to the marking sheet and drop it into the slot in your instructor’s office door, with your instructor’s name checked.