ASP NET MVC Series For Beginers Part 2

21
Gaurav Kumar Arora twitter - @g_arora A technology enthusiast, having more than 13yrs of experience in the industry. An author of CSharpCorner.

Transcript of ASP NET MVC Series For Beginers Part 2

Page 1: ASP NET MVC Series For Beginers Part 2

Gaurav Kumar Aroratwitter - @g_arora

A technology enthusiast, having more than 13yrs of experience in the industry. An author of CSharpCorner.

Page 2: ASP NET MVC Series For Beginers Part 2

ASP.Net MVC series for beginers-Part 2

Page 3: ASP NET MVC Series For Beginers Part 2

Agenda of the day

01 Revisiting Previous Session 05 Looking into advanced Model concepts

02 Getting started with a simple app 06 Learn with a demo

03 Defining Models 07 What comes next?

04 Lets create a Model 08 Closing notes

Page 4: ASP NET MVC Series For Beginers Part 2

Revisiting Previous Session

Page 5: ASP NET MVC Series For Beginers Part 2

Request/Response in an ASP.NET applicationHigh level overview

Page 6: ASP NET MVC Series For Beginers Part 2

Request processingHigh level overview – how request processed

Page 7: ASP NET MVC Series For Beginers Part 2

Pictorial representation of Models, Views and ControllersHigh level overview of MVC

Model

Page 8: ASP NET MVC Series For Beginers Part 2

Getting started with a simple app - Demo

Page 9: ASP NET MVC Series For Beginers Part 2

Lets create a Model

Page 10: ASP NET MVC Series For Beginers Part 2

What is a Model?MVC model is typically a class

Both Controller and View can access Model

A Model can be used to pass data from Controller to view

Page 11: ASP NET MVC Series For Beginers Part 2

DemoGetting started by adding a Model

Page 12: ASP NET MVC Series For Beginers Part 2

Defining Models

Page 13: ASP NET MVC Series For Beginers Part 2

Creating a Model?Adding Properties

Adding attributes to Properties

A Model can be used to pass data from Controller to view

Page 14: ASP NET MVC Series For Beginers Part 2

Attributes at a glanceMain available attributes

Attributes to check DataTypes

Attributes to Display

Attributes for validationRequiredLengthComparisonRegularExpression

Page 15: ASP NET MVC Series For Beginers Part 2

Looking into advanced Model concepts

Page 16: ASP NET MVC Series For Beginers Part 2

Client side vs. Server side validations

Server side

ModelState.IsValid

Client side

JQuery validation

Page 17: ASP NET MVC Series For Beginers Part 2

Models are awesomeCan create automatic UI

Page 18: ASP NET MVC Series For Beginers Part 2

DemoRunning demo app

Page 19: ASP NET MVC Series For Beginers Part 2

What comes next

Page 20: ASP NET MVC Series For Beginers Part 2

Q & AFew moments for handling queries

Page 21: ASP NET MVC Series For Beginers Part 2

Closing notes