Presentation is loading. Please wait.

Presentation is loading. Please wait.

MIS Professor Sandvig MIS 324 Professor Sandvig

Similar presentations


Presentation on theme: "MIS Professor Sandvig MIS 324 Professor Sandvig"— Presentation transcript:

1 MIS 324 -- Professor Sandvig MIS 324 Professor Sandvig
10/11/2019 MVC Introduction MIS 324 Professor Sandvig

2 Recap Photos exercise Controller: Handles http requests
Request includes: controller name action method name Example: ~/photos/dahlia Action method name optional Defaults to “index”

3 Recap Controller Parameters ViewBag Give each object a name
Example: photos/photoView?id=dahlia Photos/photoView/dahlia ViewBag Passes values from controller to view Give each object a name Eg: ViewBag.photo = “dahlia”;

4 Today Review photos exercise Models How to define model
Benefits How to define model Accessing from controller Passing to view

5 What is Model Model describes data Typically a real-world entity
Customer Product Order Transaction Etc.

6 Benefits of Models Model defines data Pass all fields as object
Datatypes Pass all fields as object Visual Studio Examines model: Create forms Validation

7 Benefits of Models Visual Studio wizards Uses model to create forms
Includes Validation

8 How to Define Model Add new class to model folder Syntax:

9 Accessing Model from Controller
Need to add using statement Points to “Models” namespace

10 Passing Model to from Controller

11 MIS 324 -- Professor Sandvig
10/11/2019 Summary MVC Models Define business entities Employees Customers Products All properties in single object Pass as single object Validation in definition Visual Studio wizards


Download ppt "MIS Professor Sandvig MIS 324 Professor Sandvig"

Similar presentations


Ads by Google