Assignment 1 - Introduction to ASP.NET MVC using C#
Use Visual Studio 2013 (VS) for all of the course assignments. Visual Studio 2015 uses a
newer version of Sql Server database which is not supported on the Yorktown server.
Use VS to write and debug your code then use VS to publish it on the server.
Test your code on the server and submit the working URLs via Canvas.
Visual Studio Express 2013
is a free download with includes a lightweight version of Sql Server database called LocalDB.
Visual Studio 2013 is available in the Parks Hall computer labs (and possibly other labs on campus).
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.
The assignment instructions include working samples. The code you submit
must have the same functionality 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 -
Name your project Mis324Assignments rather than MvcMovie.
You will be using this project for all of your assignments.
- Adding a controller -
MVC projects typically start with a model but the tutorial
starts with a controller to discuss routing. When you copy
the code from the tutorial for the controller copy only the
code inside the class (since your project had a different name
you don’t want to change the namespace on line 7.)
- 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.
- 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).
- 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:
- Submit your Yorktown URL in Canvas.
- helloWorld/welcome2?name=Heather&numTimes=6 -
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.
- Publish your code to the server and submit the URL as in the previous exercise.
- Complete! You have created your first MVC web application.
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.