Assignment 1 - Introduction to ASP.NET MVC using C#
Use Visual Studio 2017 (VS) for all of the course assignments.
The recommended work flow for developing ASP.NET code is to use VS to write and debug your code. When your code is finished use VS's publish feature
to publish it on the server.
Test your code on the server and submit the working URLs via Canvas.
Visual Studio 2017 is available in the Parks Hall computer labs (047 and 210).
During this course you will create only one new project in VS and add new code to it throughout
the quarter. Your hosting on Yorktown supports only one project so if you create more than one
you will run into problems on the server.
Visual Studio Tip: In this assignment you will create a folder
named Mis324Assignments. Inside this folder will be a solution file with the extension ".sln". To
open an existing project double-click on the .sln file (rather than starting Visual Studio
first). This assures that your project will open correctly.
The .sln file uses relative paths to your project files so it should not be moved from the project directory (you can
create a shortcut to it and move the shortcut).
The assignment instructions include working samples. The code you submit
must have the same functionality (or more) as the working samples. Your layout may be different.
To enlarge an image in the assignment instructions right-click on the image and select "Open image in new tab."
-- Microsoft has written an excellent tutorial
Started with ASP.NET MVC 5 that explains how to create a new project in VS,
the MVC design pattern, and creating controllers, models, and views.
Compete the first two steps of the tutorial as explained below:
- Getting Started -
Use Visual Studio 2017 rather than 2013.
Name your project Mis324Assignments rather than MvcMovie.
You will be using this project for all of your assignments.
- Adding a controller -
Copy the code from the exercise and then change the namespace
from MvcMovie to the name of your project (Mis324Assignments).
- Tip: rather than using the debugger to view your executed code press
Ctrl-Shift-b to compile your code then right-click on the Views folder
and select “View in Browser.” Thereafter as you modify your code you can
simply recompile it (with Ctrl-Shift-b) and refresh the browser.
Complete the third part of the tutorial
Adding a View. Tips:
- The tutorial asks you to modify the Welcome action method that you created in the previous step. Instead
add a second action method named "Welcome2" so that your answer for part one is not affected. Also name
the view Welcome2.cshtml.
- Complete! You have created your first MVC web application.
- Publishing to the server: when you code is working correctly in VS you can upload it to the server. Steps:
- Create a network drive map to the server.
- In VS solution explorer right click on the name of your application (Mis324Assignments) and select “Publish...”
- Click “Custom” and add a profile name.
- For Publish Method select “File System.”
- Click the “...” and find your network drive map and root folder on Yorktown (your root folder has your WWU username).
The path will look similar to:
- Click “Open,” next, next, and Publish.
- The URL on the server will be similar to this:
- In the browser you should see the default page for your web site.
- Add the name of your controller and any parameters:
- Copy the Yorktown URLs from the browser and paste into Canvas.
Submission instructions: Submit assignments via
the Canvas course management system.
Submit the full URL for each exercise in the assignment, listing the URLs
in the same order that they are listed in the assignment. To minimize typos in URLs
it is strongly recommended
that you copy the URLs from the address bar of the browser
rather than trying to type them. Incorrect URLs
will not be graded and no credit will be given.
When pages are connected via navigation (as in your music store project) it is only
necessary to submit the URL of the first page.