Lab 09 Instructions
Lab 09 Instructions
Project 9-1: Build the PIG game app
For this project, you will build a single-page app (SPA) that uses session state to persist data between requests.
Specifications
ï‚· When the app starts, or when the user clicks New Game, the scores for both players, the value for the die,
and the total for the turn should all be zero.
 When it’s their turn, a player can click Roll to roll the die or Hold to end their turn and add the point total
for that turn to their score.
ï‚· When a player clicks Roll, the app should generate and display a random number between 1 and 6 (see
elow). If the number is 1, the point total for the turn should be set to zero, and that player’s turn should
end. Otherwise, the number rolled should be added to the point total for the turn, and the player’s turn
should continue.
ï‚· When a player clicks Hold, the app should add their points for that turn to their score and then end the
turn. If the score is greater than the number of points needed to win, the app should end the game and
display the name of the winner.
ï‚· Clicking the
owser’s Refresh button should only redisplay the page, not post the previous button click
again.
ï‚· Use the Random class in the System namespace to generate a random number like this:
Random rand = new Random();
int roll = rand.Next(1, 7);
ï‚· Use session state to store game data between requests.
Lab 10 Instructions
Lab 10 Instructions
Project 10-1: Build the Tic Tac Toe app
For this project, you will build a single-page app that uses model binding to pass data between controllers and
views.
Specifications
ï‚· When the app starts, it should display nine
utton> elements, styled as above to appear as a 3-x-3 grid.
Above the grid, an
element should say that it’s X’s turn.
ï‚· When the user clicks a button, the page should post to the server, where the X or O for that button is saved.
ï‚· When the page re-loads, the clicked
utton> element should be marked X or O and should be disabled. In
addition, clicking the
owser’s Refresh button should redisplay the page, not post the previous click
again.
ï‚· After each turn, the element above the grid should say whose turn it is.
ï‚· When there are three Xs or three Os in a line (vertically, horizontally, or diagonally), the game is over and
the player with the three marks in a line wins. When this happens, the app should say who won and replace
the element with a New Game link.
 When there are no more blank cells but there’s no winner, then the game ends in a tie. When this happens,
the app should notify the user and replace the element with a New Game link.
ï‚· When the user clicks the New Game link, a new grid of
utton> elements should display. Above the grid,
an element should say that it’s X’s turn.
Lab 08 Instructions
Lab 08 Instructions
Project 8-1: Build the Trips Log app
For this project, you will build a data-driven web app that uses view models to pass data from controllers to
views, the ViewBag object to pass data from views to the layout, and TempData to persist data between
equests.
Specifications
ï‚· When the app starts, it should display trip data and an Add Trip link.
ï‚· The layout for this web app should display a banner at the top of the page, and a subhead below it.
However, the subhead should only display if there’s text in the ViewData property for it.
ï‚· When the user clicks the Add Trip link, a three page data entry process should start.
ï‚· On the first page, the user should enter data about the trip destination and dates. The Accommodations
field on this page should be optional, and the rest should be required.
ï‚· The second page should only display if the user entered a value for the Accommodations field on the first
page. On this page, the user should enter data about the accommodations. The accommodation value the
user entered should display in the subhead, and the fields should be optional.
ï‚· On the third page, the user should enter data about things to do on their trip. The destination the user
entered on the first page should display in the subhead, and the fields should be optional.
ï‚· When the user clicks the Next button on the first or second page, the web app should save the data posted
from the page in TempData. Use this data to get the user entries to display in the subheads as needed, but
make sure any data that needs to be saved to the database persists in TempData.
ï‚· When the user clicks the Save button on the third page, the web app should save the data posted from the
page and the data in TempData to the database. Then, the Home page should display with a temporary
message that the trip has been added.
ï‚· When the user clicks the Cancel button on any of the Add pages, the data in TempData should be cleared
and the Home page should display. You can use this statement to clear the data:
TempData.Clear();
ï‚· To keep things simple, store all fields for the trip in a single table like this: