Index which has a return type of actionresult and no


Assignment 2

It should have a Home controller with the following two actions:

  •  Index, which has a return type of ActionResult and no parameters. In its body, it should add the current year to the ViewBag property under the name CurrentYear.

o Its associated view should then display the following text: The current year is: X Where X is the CurrentYear value retrieved from the ViewBag property.

  • AgeCalculator, which has a return type of ActionResult and an integer parameter called BirthYear. In its body, it should subtract BirthYear from the current year and assign the result to ViewBag property under the name Age.

o Its associated view should then display the following text: You are X years old! Where X is the Age value retrieved from the ViewBag property

Part 1- MVC

For this part, you are going to create an MVC Project called Assignment as follows:
In the Models folder, create a C# class called Team with the following two auto-implemented
properties:

  • TeamName with return type string.
  • TeamCity with return type of string. In the Controllers folder create a controller called HomeController with the following actions:
  • Index, which is decorated with the [HttpGet] attribute. In its body, it should create an object of type Team and pass it on to its associated view.
  • Index, which is decorated with the [HttpPost] attribute and takes a parameter of type
  • Team. In its body, it should construct the following message and display it in its associated view.

The team name is X and the team city is Y! Where X is the TeamName and Y is the TeamCity from the Team object received from the form in its associated view. In its associated view, the Razor syntax should be used to define a form that has a label for the team name and a text box for it as well as a label for the team city and a text box for it. It should also have an input of type submit which posts the values entered by the user to the Index action, decorated with the [HttpPost] attribute. The following block shows the skeleton for the Razor form in this view.

@using (Html.BeginForm())
{


Team Name inputs go here

 


Team City inputs go here

 


}

This is very similar to the example presented in lecture 1 of this week. In brief, when the application is run, it shows the form containing the input fields where the user enters a team  Northeastern University, ITC 2811 - Advanced Application Development Assignment Page 2 of 2
name and a team city and clicks the submit input after which the page is refreshed to show the message specified earlier.

Part 2- jQuery Mobile
Answer the following questions in a Word document (or any other rich word processing program that allows you to create .doc documents), save it as Assignment10FN (where F is your first initial and L is your last initial).

1- How would you define a header for a jQuery Mobile page?
2- How would you define an area to hold the main contents of a jQuery Mobile page?
3- How would you define a footer for a jQuery Mobile page?
4- What meta tag would you use to specify the zoom and display dimensions of a jQuery
Mobile page?

Solution Preview :

Prepared by a verified Expert
Other Subject: Index which has a return type of actionresult and no
Reference No:- TGS01030511

Now Priced at $50 (50% Discount)

Recommended (99%)

Rated (4.3/5)