Enviar pesquisa
Carregar
Models
•
Transferir como PPTX, PDF
•
1 gostou
•
2,113 visualizações
Eyal Vardi
Seguir
ASP.NET MVC .30 - Models
Leia menos
Leia mais
Negócios
Diversão e humor
Vista de apresentação de diapositivos
Denunciar
Compartilhar
Vista de apresentação de diapositivos
Denunciar
Compartilhar
1 de 26
Baixar agora
Recomendados
Prism Navigation
Prism Navigation
Eyal Vardi
Views
Views
Eyal Vardi
Forms in AngularJS
Forms in AngularJS
Eyal Vardi
Asp.net web api extensibility
Asp.net web api extensibility
Eyal Vardi
ASP.NET MVC The Begining
ASP.NET MVC The Begining
Simon Huang
Puzles C#
Puzles C#
lantoli
Thiet ke co so du lieu
Thiet ke co so du lieu
ma giam gia
ASP.NET MVC Core
ASP.NET MVC Core
Eduard Tomàs
Recomendados
Prism Navigation
Prism Navigation
Eyal Vardi
Views
Views
Eyal Vardi
Forms in AngularJS
Forms in AngularJS
Eyal Vardi
Asp.net web api extensibility
Asp.net web api extensibility
Eyal Vardi
ASP.NET MVC The Begining
ASP.NET MVC The Begining
Simon Huang
Puzles C#
Puzles C#
lantoli
Thiet ke co so du lieu
Thiet ke co so du lieu
ma giam gia
ASP.NET MVC Core
ASP.NET MVC Core
Eduard Tomàs
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Brand Xanh
Asp.Net MVC 5
Asp.Net MVC 5
Emanuele Bartolesi
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
MasterCode.vn
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
MasterCode.vn
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
MasterCode.vn
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
MasterCode.vn
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
MasterCode.vn
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
MasterCode.vn
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
MasterCode.vn
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
Zalpa Rathod
Web api crud operations
Web api crud operations
Eyal Vardi
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & Extensibility
Eyal Vardi
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
SignalR
SignalR
Eyal Vardi
AMD & Require.js
AMD & Require.js
Eyal Vardi
Web api routing
Web api routing
Eyal Vardi
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Eyal Vardi
AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?
Jim Duffy
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Mais conteúdo relacionado
Destaque
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Brand Xanh
Asp.Net MVC 5
Asp.Net MVC 5
Emanuele Bartolesi
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
MasterCode.vn
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
MasterCode.vn
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
MasterCode.vn
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
MasterCode.vn
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
MasterCode.vn
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
MasterCode.vn
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
MasterCode.vn
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
Zalpa Rathod
Destaque
(13)
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Asp.Net MVC 5
Asp.Net MVC 5
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
MVC ppt presentation
MVC ppt presentation
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
Semelhante a Models
Web api crud operations
Web api crud operations
Eyal Vardi
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & Extensibility
Eyal Vardi
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
SignalR
SignalR
Eyal Vardi
AMD & Require.js
AMD & Require.js
Eyal Vardi
Web api routing
Web api routing
Eyal Vardi
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Eyal Vardi
AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?
Jim Duffy
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Incorporating OAuth
Incorporating OAuth
Twobo Technologies
Asp.net mvc filters
Asp.net mvc filters
Eyal Vardi
Incorporating OAuth: How to integrate OAuth into your mobile app
Incorporating OAuth: How to integrate OAuth into your mobile app
Nordic APIs
Asp.NET MVC
Asp.NET MVC
vrluckyin
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
ukdpe
Domain driven design
Domain driven design
Amit Mukherjee
Polymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele Gallotti
ThinkOpen
Prompt engineering for iOS developers (How LLMs and GenAI work)
Prompt engineering for iOS developers (How LLMs and GenAI work)
Andrey Volobuev
Dhtmlx isis viewer
Dhtmlx isis viewer
mylaensys
Entity Framework - Queries
Entity Framework - Queries
Eyal Vardi
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
DataGeekery
Semelhante a Models
(20)
Web api crud operations
Web api crud operations
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & Extensibility
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
SignalR
SignalR
AMD & Require.js
AMD & Require.js
Web api routing
Web api routing
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
AngularJS: What's the Big Deal?
AngularJS: What's the Big Deal?
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Incorporating OAuth
Incorporating OAuth
Asp.net mvc filters
Asp.net mvc filters
Incorporating OAuth: How to integrate OAuth into your mobile app
Incorporating OAuth: How to integrate OAuth into your mobile app
Asp.NET MVC
Asp.NET MVC
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
Domain driven design
Domain driven design
Polymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele Gallotti
Prompt engineering for iOS developers (How LLMs and GenAI work)
Prompt engineering for iOS developers (How LLMs and GenAI work)
Dhtmlx isis viewer
Dhtmlx isis viewer
Entity Framework - Queries
Entity Framework - Queries
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Mais de Eyal Vardi
Why magic
Why magic
Eyal Vardi
Smart Contract
Smart Contract
Eyal Vardi
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Eyal Vardi
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Eyal Vardi
Angular 2 NgModule
Angular 2 NgModule
Eyal Vardi
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Eyal Vardi
Routing And Navigation
Routing And Navigation
Eyal Vardi
Angular 2 Architecture
Angular 2 Architecture
Eyal Vardi
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Eyal Vardi
Angular 2.0 Views
Angular 2.0 Views
Eyal Vardi
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Eyal Vardi
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Eyal Vardi
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Eyal Vardi
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Angular 2.0 Pipes
Angular 2.0 Pipes
Eyal Vardi
Angular 2.0 forms
Angular 2.0 forms
Eyal Vardi
Mais de Eyal Vardi
(20)
Why magic
Why magic
Smart Contract
Smart Contract
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 NgModule
Angular 2 NgModule
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Routing And Navigation
Routing And Navigation
Angular 2 Architecture
Angular 2 Architecture
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Angular 2.0 Views
Angular 2.0 Views
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Angular 2.0 Pipes
Angular 2.0 Pipes
Angular 2.0 forms
Angular 2.0 forms
Último
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
daisycvs
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
rwgiffor
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
hemanthkumar470700
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
Aggregage
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
Eluru Call Girls Service ☎ ️93326-06886 ❤️🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️🔥 Enjoy 24/7 Escort Service
Damini Dixit
Falcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business Potential
Falcon investment
Organizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
Seta Wicaksana
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
dlhescort
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
lizamodels9
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)- A new venture concept
P&CO
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
dollysharma2066
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
lizamodels9
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Admir Softic
Último
(20)
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
Eluru Call Girls Service ☎ ️93326-06886 ❤️🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️🔥 Enjoy 24/7 Escort Service
Falcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business Potential
Organizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls In Nangloi Rly Metro ꧂…….95996 … 13876 Enjoy ꧂Escort
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)- A new venture concept
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Models
1.
Models in MVC
Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog: www.eVardi.com
2.
Models in MVC
Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog: www.eVardi.com
3.
Agenda
Integrating the Model & Controller Model Binders Model Validation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
4.
What Is a
Model? Model Template Model Deserialization HTML View Controller HTTP Template © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
5.
Model Attributes
Scaffolding [ScaffoldColumn] View [HiddenInput] [Display] [DisplayName], Attribute on a Class [DataType(...)] [UIHint(...)] [AdditionalMetadata( key , value )] © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
6.
Display Attribute
[DisplayName("Book")] Model public class E4DBook { [Display(Name = "Title")] public string E4DTitle { get; set; } } <h2>@Html.LabelForModel()</h2> View @Html.EditorForModel() Or @Html.LabelFor(m => m.E4DTitle) © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
7.
DataType Attribute
DateTime Password Date Url Time EmailAddress Text MultilineText © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
8.
UIHint Attribute
Use the UIHint attribute to specify the template we want to use to render HTML for a property. [DisplayName("Book")] Model public class E4DBook { [Display(Name = "Title")] [DateType(DataType.MultilineText)] [UIHint("MultilineText")] public string E4DTitle { get; set; } } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
9.
Built in View
Template Boolean Object Collection Password Decimal String EmailAddress Text HiddenInput Url Html MultilineText © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
10.
Model Templates © 2010
E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
11.
What Is a
Model? Model Binding Model Deserialization HTML View Controller HTTP Template © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
12.
HTTP to .NET
Classes public ActionResult Index(Reservation reservation) { // TODO BL. return View( reservation ); } Deserialization © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
13.
Model Binders
Binders are like type converters, because they can convert HTTP requests into objects that are passed to an action method. © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
14.
DefaultModelBinder Class
Translate HTTP request into complex models, including nested types and arrays. URL Form data, Culture - Sensitive 1. Request.Form 2. RoutedData.Values (Key,Value) 3. Request.QueryString 4. Request.Files © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
15.
Binding to Complex
Types [DisplayName("Book")] Model public class E4DBook { [Display(Name = "Title")] public string E4DTitle { get; set; } public Reservation MyReservation { get; set; } } @Html.LabelFor(model => model.MyReservation.FlightNum) View @Html.EditorFor(model => model.MyReservation.FlightNum) Html <label for="MyReservation_FlightNum">FlightNum</label> <input type="text" value="" id = "MyReservation_FlightNum" name = "MyReservation.FlightNum" /> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
16.
Specifying Custom Prefixes
Controller public ActionResult Index( Reservation res1 , [Bind(Prefix="myRes")] Reservation res2 ) { ... } <!– First Arg --> Html <label for="FlightNum">FlightNum</label> <input type="text" id="FlightNum" name="FlightNum" /> ... <!– Second Arg --> <label for="MyRes_FlightNum">FlightNum</label> <input type="text" id="MyRes_FlightNum" name="MyRes.FlightNum" /> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
17.
Bind Attribute (“View”)
Represents an attribute that is used to provide details about how model binding to a parameter should occur. [Bind(Include = "FlightNum, TravelDate)] public class Reservation { public int FlightNum { get; set; } public DateTime TravelDate { get; set; } public int TicketCount { get; set; } public int DiscountPercent { get; set; } } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
18.
Bind Attribute © 2010
E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
19.
Binding to a
String Collections Controller public ActionResult Index( List< string > reservation ) { ... } Html <input type="text" name="reservation" value="…" /> <input type="text" name="reservation" value="…" /> <input type="text" name="reservation" value="…" /> <input type="text" name="reservation" value="…" /> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
20.
Binding to a
Collections Controller public ActionResult Index( List<Reservation> reservation ) { ... } <!– Option I--> Html <input type="text" name="[0].Name" /> <input type="text" name="[1].Name" /> <!– Option II --> <input type="hidden" name="Index" value="f1" /> <input type="text" name="[f1].Name" /> <input type="hidden" name="Index" value="f2" /> <input type="text" name="[f2].Name" /> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
21.
Binding to a
Dictionary Controller public ActionResult Index( Dictionary<Reservation> reservation ) { ... } Html <input type="hidden" name="[0].key" value="f1" /> <input type="text" name="[0].value.Name" /> <input type="hidden" name="[1].key" value="f2" /> <input type="text" name="[1].value.Name" /> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
22.
Manually Invoking Model
Binding © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
23.
Custom Model Binders
ASP.NET MVC allows us to override both the default model binder, as well as add custom model binders. ModelBinders.Binders.DefaultBinder = new CustomDefaultBinder(); ModelBinders.Binders.Add( typeof(DateTime), new DateTimeModelBinder() ); © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
24.
ModelBinder Attribute
Represents an attribute that is used to associate a model type to a model-builder type. public ActionResult Contact( [ModelBinder(typeof(ContactBinder))] Contact contact ) { ViewData["name"] = contact.Name; ViewData["email"] = contact.Email; ViewData["message"] = contact.Message; ViewData["title"] = "Succes!"; return View(); } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
25.
Custom Binder © 2010
E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
26.
Integrating The Model
& Controller Deserialization public ActionResult Index(Reservation reservation) { int totalCost = reservation.TicketCount * 100; if (reservation.DiscountPercent != 0) { BL totalCost -= (totalCost * reservation.DiscountPercent / 100); } ViewBag.TotalCost = totalCost; Index.cshtml @model Reservation return View( reservation ); } Model © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Baixar agora