SlideShare a Scribd company logo
Getting Started with MVC 5 and
Visual Studio 2013
Thomas Robbins, Kentico CMS (thomasr@Kentico.com)
@trobbins
Slides will be available at: http://bit.ly/thomrobbins
What we will talk about
• This is an introductory session on MVC 5 and
VS 2013 is designed to get you going.
• We’ll look at the Why of MVC vs Web Forms 
• We’ll also look at some best practices and
things to think about
• Lots of other great sessions and information
available.
A history lesson..
ASP.NET Web Form
• A set of UI components
(pages, buttons etc.)
plus a stateful object
oriented GUI
programming model

ASP.NET
• A way to host .NET
application in IIS that let’s
you interact with HTTP
requests and responses

.NET
• A multi-language managed
code platform

The Strength of ASP.NET Web Forms
• Making web development feel the same
as Windows Form development
• No need to work with individual HTTP
requests and easier to think in terms of a
stateful UI
Some problems with ASP.NET Web Forms
• View state weight – Mechanism for maintaining
state (view state) results in large blocks of data
between client and server
• Page life cycle – Connecting client side events with
server side event handler code is complicated and
delicate
• False sense of separation – ASP.NET web Forms
code behind model provides a means to take
application code out of HTML markup.
Unfortunately, this allows for mix presentation
models (manipulating a server side tree)
• Limited control over HTML – Server side controls
render themselves as HTML but not always the
HTML you want
• Low testability – Nobody could have anticipated
that automated testing would become essential
Not all bad – ASP.NET Web Forms provide a quick results and allows reasonably complex
web applications to be built quickly!
What matters…
Code reusability
• Shortens development
• Code libraries
• Design patterns
• Frameworks

Separation of concerns
• Improves code clarity and
organization
• Helps troubleshoot by
isolating issues
• Allows for multiple teams to
develop simultaneously
Say hello to MVC!
It’s a pattern
• Model: Handles data
and business logic
• View: Presents data to
the user using any
supported form and
layout
• Controller: receives
user requests and calls
appropriate resources
to carry them out
What is MVC?
• Model represents the data model
– “Manages behavior and data of the
application domain”

• View represents the screen
shown to the user
– “Manages the graphical and/or
textual output to the portion of the
bitmapped display that is allocated
to the application”

• Controller represents interaction
from the user that changes the
data and the view
– “Interprets the mouse and
keyboard inputs from the user,
commanding the model and/or the
view to changes as appropriate”
MVC isn’t new!
• Presented by Trygve
Reenskaug in 1979
• First used in the
Smalltalk-80 framework
– Used in making Apple
interfaces (Lisa and
Macintosh)
Step by Step
The Controller asks
the Model for data
The request hits the
controller

B
r
o
w
s
e
r

Model

2

1

3
Controller

The controller formats the
data and passes them to the
View

The Model gives the data
back to the Controller

4

5
The view renders the HTML
that needs to be sent to the
client

View
Example control flow in MVC
• User interacts with the View UI
• Controller handles the user input (often a
callback function attached to a UI element)
• Controller updates the Model
• View uses the model to generate new UI
• UI waits for user interaction
What’s the point?
• Provides a logical structure for heavily
interactive system
• Adheres to good engineering design principles
and practices
– Information hiding, less coupling, simplicity, etc.
– Delegated control style
Getting started with MVC 5
The project structure
• App_Data is the physical store for data. This folder
has the same role as it does in ASP.NET web sites
that use Web Form pages
• Content is the recommended location to add static
content files like CSS and images
• Controllers is the recommended location for
controllers. All controllers must end with
“Controller”
• Models is provided for classes that represent the
application model. This folder usually contains code
that defines objects and logic for application with
the data store
• Scripts is the recommended location for script files
that support the application. By default this folder
contains ASP.NET Ajax Foundation files and Jquery
• Views is the recommended location for views. These
are ViewPage (.aspx), ViewUserControl (.ascx) and
ViewMaster (.master) in additional to any other files
needed for renderings. The view folder also contains
a folder for each controller.
Everything has it’s advantages
MVC
• Easier to Manage
Complexity
• Does not use view state or
server based forms
• Rich Routing Structure
• Support for Test-Driven
Development
• Supports Large Teams Well

WebForms
• Preservers State over HTTP
• Page Controller Pattern
• View state or server based
forms
• Works well for small teams
• Development is less
complex
The beauty of MVC

It’s Restful!
MVC Routes
• A route is an object that
parses a requested URL and it
determines the controller
and action to which the
request is forwarded
• Routing operates on the
directories and the file name
of tin the relative URL
Uses the format
/[Controller]/[ActionName]/[Parameters]
What’s the route
• Matching a URL request to a route depends on all
of the following conditions:
– The route patterns that you have defined or the
default route patterns, if any, that are included in your
project type.
– The order in which you added them to the Routes
collection.
– Any default values that you have provided for a route.
– Any constraints that you have provided for a route.
– Whether you have defined routing to handle requests
that match a physical file.
Models
What is a model
• The model should contain
all of the application
business logic, validation
logic, and database access
logic.
• Supports a code first
model using the Entity
Framework (EF)
• All .edmx files, .dbml files
etc. should be located in
the Models folder.
Custom view model
• When you combine properties to display on a
View

Similar problem with ASP.NET Webforms…
View
What is a View






Most of the Controller Actions return views
The path to the view is inferred from the name of the controller
and the name of the controller action.

ViewsControllerNameControllerAction.aspx
A view is a standard (X)HTML document that can contain scripts.
script delimiters <% and %> in the views
Passing data to a view


With ViewData:


ViewData["message"] = "Hello World!";



Strongly typed ViewData:
ViewData.Model = OurModel;



With ViewBag:


ViewBag.Message = "Hello World!";
Post data to a controller
• Verb Attributes
• The action method in the controller accepts the values
posted from the view.
• The view form fields must match the same names in the
controller.
[HttpPost]
public ActionResult Edit(Meeting meeting)
{
if (ModelState.IsValid)
{
db.Entry(movie).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(meeting);
}
Controller
What is a controller
• It’s a class derived from
System.Web.MVC.Controller class
• Generate the response to the browser request
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
}
Controller actions





Public method of the Controller class
Cannot be overloaded
Cannot be a static method
Returns action result

public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
}
Other Features

•
•
•
•

Scaffolding
Test Driven Development
Internationalization
Many More
MVC Best Practices
MVC best practice #1

Delete AccountController.cs

Why
• You will probably never use these account
management pages
• Keeping demo code in production
application is not a good practice
MVC best practice #2

• Isolate controller from the external world
– HTTPContext
– Data access classes
– Configuration management
– Logging
– Etc..
Why
• Increases testability of your application
• Increases flexibility of your application
View best practice #3

Avoid “magic strings”
A magic string is an input that a programmer believes will never come externally and
which activates hidden functionality. A user would likely provide input that gives
unexpected responses in most situations. However, if the user innocently provides a predefined input, invoking external functionality, the program response is unexpected (“it’s
magic”)

What should you do
• Avoid using ViewData*“key”+
• Always create a ViewModel for each View and inherit from
“System.Web.MVC.ViewPage<ListViewModel>
MVC best practice #4

Get creative and personalize your experience

What should you do
• ASP.NET MVC is the base on which to build your own reference architecture
• Controllers and views inherit from your own base class
• Always create a ViewModel for each View and inherit from
“System.Web.MVC.ViewPage<ListViewModel>
MVC best practice #5

Choose your view engine carefully

What’s a view engine?
A view engine is responsible for rendering HTML from your views to the browser.
Why?
• Default is WebFormViewEngine and may not be the best
• Choose the one that makes the most sense for you

View Engine

Description

Razor

The Razor view engine is an advanced view engine from Microsoft. Razor using
an @ character instead of aspx's <% %> and Razor does not require you to
explicitly close the code-block, this view engine is parsed intelligently by the
run-time to determine what is a presentation element and what is a code
element.

ASPX

The syntax for writing views with this engine is the same syntax that the ASP.NET
Web Forms uses and the file extensions are also taken from ASP.NET Web Form
(.aspx, .ascx, .master) . The coding will give us the memory of legacy ASP style.
And many more….
MVC best practice #6

Avoid logic in your views
What can you do
• While it is allowed to have “if” and “For Each” when possible hide them in an
HTMLHelper
• Represents support for rendering HTML controls in a view
• Just a string that returns a string that can represent any type of
content that you want
• MVC Framework includes standard HTML helpers
• HTML.ActionLink() • HTML.TextArea
• HTML.BeginForm() • HTML.TextBox
• HTML.Checkbox()
• HTML.Dropdown()
• HTML.EndForm
• HTML.Hidden
• HTML.ListBox
• HTML.Password()
• HTML.RadioButton
MVC Best Practice #7

When an ASP.NET MVC Web application runs in IIS 7.0, no file name
extension is required for MVC projects. However, in IIS 6.0, the
handler requires that you map the .mvc file name extension to the
ASP.NET ISAPI DLL.
MVC best practice #8

Pay attention to verbs
What happens when you refresh or submit a form?

Leverage the Post/Redirect/Get (PRG) Patter
• View sends data in POST
• Modify data in POST
• Controller validates
• Renders the View with errors (POST)
• Redirect in GET
• View renders the results in GET
• Show data in GET
Wrap up…
• MVC is not the only
solution but
becoming increasingly
the answer
• VS 2013 has MVC 5
ready to go
Who are we?
Kentico CMS is one of the
most powerful Customer
Experience Management
Systems and Content
Management Systems on
the planet. With over
16,000 web sites in 90
countries it is used for
everything from simple web
sites to complex
applications.
Kentico CMS is easy to
install, simple to manage
and reliable.

More Related Content

What's hot

ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen
 
ASP.NET MVC for Begineers
ASP.NET MVC for BegineersASP.NET MVC for Begineers
ASP.NET MVC for Begineers
Shravan Kumar Kasagoni
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
Sergey Seletsky
 
What's new in asp.net mvc 4
What's new in asp.net mvc 4What's new in asp.net mvc 4
What's new in asp.net mvc 4
Simone Chiaretta
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
Nitin Sawant
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
Silver Light By Nyros Developer
Silver Light By Nyros DeveloperSilver Light By Nyros Developer
Silver Light By Nyros Developer
Nyros Technologies
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Naga Harish M
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
ASP .NET MVC - best practices
ASP .NET MVC - best practicesASP .NET MVC - best practices
ASP .NET MVC - best practices
Bohdan Pashkovskyi
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
Shiju Varghese
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
Bhagath Gopinath
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Er. Kamal Bhusal
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
Noam Kfir
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
Shiju Varghese
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro
 
Mvc
MvcMvc
Mvc
abhigad
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Joe Wilson
 

What's hot (20)

ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
ASP.NET MVC for Begineers
ASP.NET MVC for BegineersASP.NET MVC for Begineers
ASP.NET MVC for Begineers
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
 
What's new in asp.net mvc 4
What's new in asp.net mvc 4What's new in asp.net mvc 4
What's new in asp.net mvc 4
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
 
Silver Light By Nyros Developer
Silver Light By Nyros DeveloperSilver Light By Nyros Developer
Silver Light By Nyros Developer
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
 
ASP .NET MVC - best practices
ASP .NET MVC - best practicesASP .NET MVC - best practices
ASP .NET MVC - best practices
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Mvc
MvcMvc
Mvc
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
 

Viewers also liked

ASP.NET 5 & MVC 6 (RC1)
ASP.NET 5 & MVC 6 (RC1)ASP.NET 5 & MVC 6 (RC1)
ASP.NET 5 & MVC 6 (RC1)
José María Aguilar
 
New and improved ASP.NET MVC 5
New and improved ASP.NET MVC 5New and improved ASP.NET MVC 5
New and improved ASP.NET MVC 5
Maurice De Beijer [MVP]
 
Ejercicio basico en asp.net LOZADA ERICK
Ejercicio basico en asp.net LOZADA ERICKEjercicio basico en asp.net LOZADA ERICK
Ejercicio basico en asp.net LOZADA ERICK
Erick Paul Lozada Peñarreta
 
Introduction to ASP.Net Mvc3 with Razor
Introduction to ASP.Net Mvc3 with RazorIntroduction to ASP.Net Mvc3 with Razor
Introduction to ASP.Net Mvc3 with Razor
Manoj Kumar
 
Intro to asp.net mvc 4 with visual studio
Intro to asp.net mvc 4 with visual studioIntro to asp.net mvc 4 with visual studio
Intro to asp.net mvc 4 with visual studio
Organisation for Economic Co-operation & Development
 
ASP.NET MVC Tips, Tricks and Hidden Gems
ASP.NET MVC Tips, Tricks and Hidden GemsASP.NET MVC Tips, Tricks and Hidden Gems
ASP.NET MVC Tips, Tricks and Hidden Gems
Shay Friedman
 
The Big Comparison of ASP.NET MVC View Engines
The Big Comparison of ASP.NET MVC View EnginesThe Big Comparison of ASP.NET MVC View Engines
The Big Comparison of ASP.NET MVC View Engines
Shay Friedman
 
Learning styles of Individuals with Autism - Autism Awareness Month
Learning styles of Individuals with Autism - Autism Awareness MonthLearning styles of Individuals with Autism - Autism Awareness Month
Learning styles of Individuals with Autism - Autism Awareness Month
Karina Barley - M.Ed.
 
jQuery in 10 minuten
jQuery in 10 minutenjQuery in 10 minuten
jQuery in 10 minuten
Anne Jan Roeleveld
 
ASP.NET 4.6 e ASP.NET 5...l'evoluzione del web
ASP.NET 4.6 e ASP.NET 5...l'evoluzione del webASP.NET 4.6 e ASP.NET 5...l'evoluzione del web
ASP.NET 4.6 e ASP.NET 5...l'evoluzione del web
Andrea Dottor
 
Asp.Net MVC - Razor Syntax
Asp.Net MVC - Razor SyntaxAsp.Net MVC - Razor Syntax
Asp.Net MVC - Razor Syntax
Renier Serven
 
Multi-Device Hybrid Apps con Visual Studio e Apache Cordova
Multi-Device Hybrid Apps con Visual Studio e Apache CordovaMulti-Device Hybrid Apps con Visual Studio e Apache Cordova
Multi-Device Hybrid Apps con Visual Studio e Apache Cordova
Andrea Dottor
 
ASP.NET performance optimization
ASP.NET performance optimizationASP.NET performance optimization
ASP.NET performance optimization
Andrea Dottor
 
ASP.NET MVC 6 - uno sguardo al futuro
ASP.NET MVC 6 - uno sguardo al futuroASP.NET MVC 6 - uno sguardo al futuro
ASP.NET MVC 6 - uno sguardo al futuro
Andrea Dottor
 
Getting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorGetting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and Razor
Dan Wahlin
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
Ido Flatow
 

Viewers also liked (17)

ASP.NET 5 & MVC 6 (RC1)
ASP.NET 5 & MVC 6 (RC1)ASP.NET 5 & MVC 6 (RC1)
ASP.NET 5 & MVC 6 (RC1)
 
Asp.Net MVC 5
Asp.Net MVC 5Asp.Net MVC 5
Asp.Net MVC 5
 
New and improved ASP.NET MVC 5
New and improved ASP.NET MVC 5New and improved ASP.NET MVC 5
New and improved ASP.NET MVC 5
 
Ejercicio basico en asp.net LOZADA ERICK
Ejercicio basico en asp.net LOZADA ERICKEjercicio basico en asp.net LOZADA ERICK
Ejercicio basico en asp.net LOZADA ERICK
 
Introduction to ASP.Net Mvc3 with Razor
Introduction to ASP.Net Mvc3 with RazorIntroduction to ASP.Net Mvc3 with Razor
Introduction to ASP.Net Mvc3 with Razor
 
Intro to asp.net mvc 4 with visual studio
Intro to asp.net mvc 4 with visual studioIntro to asp.net mvc 4 with visual studio
Intro to asp.net mvc 4 with visual studio
 
ASP.NET MVC Tips, Tricks and Hidden Gems
ASP.NET MVC Tips, Tricks and Hidden GemsASP.NET MVC Tips, Tricks and Hidden Gems
ASP.NET MVC Tips, Tricks and Hidden Gems
 
The Big Comparison of ASP.NET MVC View Engines
The Big Comparison of ASP.NET MVC View EnginesThe Big Comparison of ASP.NET MVC View Engines
The Big Comparison of ASP.NET MVC View Engines
 
Learning styles of Individuals with Autism - Autism Awareness Month
Learning styles of Individuals with Autism - Autism Awareness MonthLearning styles of Individuals with Autism - Autism Awareness Month
Learning styles of Individuals with Autism - Autism Awareness Month
 
jQuery in 10 minuten
jQuery in 10 minutenjQuery in 10 minuten
jQuery in 10 minuten
 
ASP.NET 4.6 e ASP.NET 5...l'evoluzione del web
ASP.NET 4.6 e ASP.NET 5...l'evoluzione del webASP.NET 4.6 e ASP.NET 5...l'evoluzione del web
ASP.NET 4.6 e ASP.NET 5...l'evoluzione del web
 
Asp.Net MVC - Razor Syntax
Asp.Net MVC - Razor SyntaxAsp.Net MVC - Razor Syntax
Asp.Net MVC - Razor Syntax
 
Multi-Device Hybrid Apps con Visual Studio e Apache Cordova
Multi-Device Hybrid Apps con Visual Studio e Apache CordovaMulti-Device Hybrid Apps con Visual Studio e Apache Cordova
Multi-Device Hybrid Apps con Visual Studio e Apache Cordova
 
ASP.NET performance optimization
ASP.NET performance optimizationASP.NET performance optimization
ASP.NET performance optimization
 
ASP.NET MVC 6 - uno sguardo al futuro
ASP.NET MVC 6 - uno sguardo al futuroASP.NET MVC 6 - uno sguardo al futuro
ASP.NET MVC 6 - uno sguardo al futuro
 
Getting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorGetting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and Razor
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
 

Similar to Getting started with MVC 5 and Visual Studio 2013

Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
Fajar Baskoro
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
Fajar Baskoro
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
Sagar Kamate
 
Mvc
MvcMvc
MVC architecture
MVC architectureMVC architecture
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
pratik satikunvar
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
rainynovember12
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
4. Introduction to ASP.NET MVC - Part I
4. Introduction to ASP.NET MVC - Part I4. Introduction to ASP.NET MVC - Part I
4. Introduction to ASP.NET MVC - Part I
Rohit Rao
 
Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
Jennie Gajjar
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
Innovation Studio
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
Nguyễn Thành Phát
 
Mcv design patterns
Mcv design patternsMcv design patterns
Mcv design patterns
Rob Paok
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
Prashant Kumar
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
Inocentshuja Ahmad
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
 

Similar to Getting started with MVC 5 and Visual Studio 2013 (20)

Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
 
Mvc
MvcMvc
Mvc
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
 
4. Introduction to ASP.NET MVC - Part I
4. Introduction to ASP.NET MVC - Part I4. Introduction to ASP.NET MVC - Part I
4. Introduction to ASP.NET MVC - Part I
 
Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
 
Mcv design patterns
Mcv design patternsMcv design patterns
Mcv design patterns
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 

More from Thomas Robbins

PlayFab Advanced Cloud Script
PlayFab Advanced Cloud ScriptPlayFab Advanced Cloud Script
PlayFab Advanced Cloud Script
Thomas Robbins
 
What’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewardsWhat’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewards
Thomas Robbins
 
Getting started with Cloud Script
Getting started with Cloud ScriptGetting started with Cloud Script
Getting started with Cloud Script
Thomas Robbins
 
Say hello to the new PlayFab!
Say hello to the new PlayFab!Say hello to the new PlayFab!
Say hello to the new PlayFab!
Thomas Robbins
 
Data-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of ValueData-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of Value
Thomas Robbins
 
Financial Transparency Trailblazers
Financial Transparency TrailblazersFinancial Transparency Trailblazers
Financial Transparency Trailblazers
Thomas Robbins
 
Telling Stories with Open Data
Telling Stories with Open DataTelling Stories with Open Data
Telling Stories with Open Data
Thomas Robbins
 
Socrata Financial Transparency Suite
Socrata Financial Transparency Suite Socrata Financial Transparency Suite
Socrata Financial Transparency Suite
Thomas Robbins
 
Socrata Service Connect
Socrata Service ConnectSocrata Service Connect
Socrata Service Connect
Thomas Robbins
 
Leveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive InnovationLeveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive Innovation
Thomas Robbins
 
Here Comes Kentico 8
Here Comes Kentico 8Here Comes Kentico 8
Here Comes Kentico 8
Thomas Robbins
 
Say hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrivedSay hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrived
Thomas Robbins
 
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
Thomas Robbins
 
Digital marketing best practices
Digital marketing best practices Digital marketing best practices
Digital marketing best practices
Thomas Robbins
 
Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?
Thomas Robbins
 
Common questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMSCommon questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMS
Thomas Robbins
 
Advanced development with Windows Azure
Advanced development with Windows AzureAdvanced development with Windows Azure
Advanced development with Windows Azure
Thomas Robbins
 
Best Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows AzureBest Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows Azure
Thomas Robbins
 
Deployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows AzureDeployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows Azure
Thomas Robbins
 
Go…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows AzureGo…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows Azure
Thomas Robbins
 

More from Thomas Robbins (20)

PlayFab Advanced Cloud Script
PlayFab Advanced Cloud ScriptPlayFab Advanced Cloud Script
PlayFab Advanced Cloud Script
 
What’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewardsWhat’s in the box? Creating chance mechanics and rewards
What’s in the box? Creating chance mechanics and rewards
 
Getting started with Cloud Script
Getting started with Cloud ScriptGetting started with Cloud Script
Getting started with Cloud Script
 
Say hello to the new PlayFab!
Say hello to the new PlayFab!Say hello to the new PlayFab!
Say hello to the new PlayFab!
 
Data-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of ValueData-Driven Government: Explore the Four Pillars of Value
Data-Driven Government: Explore the Four Pillars of Value
 
Financial Transparency Trailblazers
Financial Transparency TrailblazersFinancial Transparency Trailblazers
Financial Transparency Trailblazers
 
Telling Stories with Open Data
Telling Stories with Open DataTelling Stories with Open Data
Telling Stories with Open Data
 
Socrata Financial Transparency Suite
Socrata Financial Transparency Suite Socrata Financial Transparency Suite
Socrata Financial Transparency Suite
 
Socrata Service Connect
Socrata Service ConnectSocrata Service Connect
Socrata Service Connect
 
Leveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive InnovationLeveraging Data to Engage Citizens and Drive Innovation
Leveraging Data to Engage Citizens and Drive Innovation
 
Here Comes Kentico 8
Here Comes Kentico 8Here Comes Kentico 8
Here Comes Kentico 8
 
Say hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrivedSay hello to Kentico 8! Your integrated marketing solution has arrived
Say hello to Kentico 8! Your integrated marketing solution has arrived
 
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...One Size does Not Fit All: Selecting the Right Mobile StrategyKentico   mobil...
One Size does Not Fit All: Selecting the Right Mobile StrategyKentico mobil...
 
Digital marketing best practices
Digital marketing best practices Digital marketing best practices
Digital marketing best practices
 
Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?Do you speak digital marketing with Kentico CMS?
Do you speak digital marketing with Kentico CMS?
 
Common questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMSCommon questions for Windows Azure and Kentico CMS
Common questions for Windows Azure and Kentico CMS
 
Advanced development with Windows Azure
Advanced development with Windows AzureAdvanced development with Windows Azure
Advanced development with Windows Azure
 
Best Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows AzureBest Practices for Kentico CMS and Windows Azure
Best Practices for Kentico CMS and Windows Azure
 
Deployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows AzureDeployment options for Kentico CMS on Windows Azure
Deployment options for Kentico CMS on Windows Azure
 
Go…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows AzureGo…Running Kentico CMS on Windows Azure
Go…Running Kentico CMS on Windows Azure
 

Recently uploaded

The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
ScyllaDB
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 

Recently uploaded (20)

The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 

Getting started with MVC 5 and Visual Studio 2013

  • 1. Getting Started with MVC 5 and Visual Studio 2013 Thomas Robbins, Kentico CMS (thomasr@Kentico.com) @trobbins Slides will be available at: http://bit.ly/thomrobbins
  • 2. What we will talk about • This is an introductory session on MVC 5 and VS 2013 is designed to get you going. • We’ll look at the Why of MVC vs Web Forms  • We’ll also look at some best practices and things to think about • Lots of other great sessions and information available.
  • 3. A history lesson.. ASP.NET Web Form • A set of UI components (pages, buttons etc.) plus a stateful object oriented GUI programming model ASP.NET • A way to host .NET application in IIS that let’s you interact with HTTP requests and responses .NET • A multi-language managed code platform The Strength of ASP.NET Web Forms • Making web development feel the same as Windows Form development • No need to work with individual HTTP requests and easier to think in terms of a stateful UI
  • 4. Some problems with ASP.NET Web Forms • View state weight – Mechanism for maintaining state (view state) results in large blocks of data between client and server • Page life cycle – Connecting client side events with server side event handler code is complicated and delicate • False sense of separation – ASP.NET web Forms code behind model provides a means to take application code out of HTML markup. Unfortunately, this allows for mix presentation models (manipulating a server side tree) • Limited control over HTML – Server side controls render themselves as HTML but not always the HTML you want • Low testability – Nobody could have anticipated that automated testing would become essential Not all bad – ASP.NET Web Forms provide a quick results and allows reasonably complex web applications to be built quickly!
  • 5. What matters… Code reusability • Shortens development • Code libraries • Design patterns • Frameworks Separation of concerns • Improves code clarity and organization • Helps troubleshoot by isolating issues • Allows for multiple teams to develop simultaneously
  • 7. It’s a pattern • Model: Handles data and business logic • View: Presents data to the user using any supported form and layout • Controller: receives user requests and calls appropriate resources to carry them out
  • 8. What is MVC? • Model represents the data model – “Manages behavior and data of the application domain” • View represents the screen shown to the user – “Manages the graphical and/or textual output to the portion of the bitmapped display that is allocated to the application” • Controller represents interaction from the user that changes the data and the view – “Interprets the mouse and keyboard inputs from the user, commanding the model and/or the view to changes as appropriate”
  • 9. MVC isn’t new! • Presented by Trygve Reenskaug in 1979 • First used in the Smalltalk-80 framework – Used in making Apple interfaces (Lisa and Macintosh)
  • 10. Step by Step The Controller asks the Model for data The request hits the controller B r o w s e r Model 2 1 3 Controller The controller formats the data and passes them to the View The Model gives the data back to the Controller 4 5 The view renders the HTML that needs to be sent to the client View
  • 11. Example control flow in MVC • User interacts with the View UI • Controller handles the user input (often a callback function attached to a UI element) • Controller updates the Model • View uses the model to generate new UI • UI waits for user interaction
  • 12. What’s the point? • Provides a logical structure for heavily interactive system • Adheres to good engineering design principles and practices – Information hiding, less coupling, simplicity, etc. – Delegated control style
  • 14. The project structure • App_Data is the physical store for data. This folder has the same role as it does in ASP.NET web sites that use Web Form pages • Content is the recommended location to add static content files like CSS and images • Controllers is the recommended location for controllers. All controllers must end with “Controller” • Models is provided for classes that represent the application model. This folder usually contains code that defines objects and logic for application with the data store • Scripts is the recommended location for script files that support the application. By default this folder contains ASP.NET Ajax Foundation files and Jquery • Views is the recommended location for views. These are ViewPage (.aspx), ViewUserControl (.ascx) and ViewMaster (.master) in additional to any other files needed for renderings. The view folder also contains a folder for each controller.
  • 15. Everything has it’s advantages MVC • Easier to Manage Complexity • Does not use view state or server based forms • Rich Routing Structure • Support for Test-Driven Development • Supports Large Teams Well WebForms • Preservers State over HTTP • Page Controller Pattern • View state or server based forms • Works well for small teams • Development is less complex
  • 16. The beauty of MVC It’s Restful!
  • 17. MVC Routes • A route is an object that parses a requested URL and it determines the controller and action to which the request is forwarded • Routing operates on the directories and the file name of tin the relative URL Uses the format /[Controller]/[ActionName]/[Parameters]
  • 18. What’s the route • Matching a URL request to a route depends on all of the following conditions: – The route patterns that you have defined or the default route patterns, if any, that are included in your project type. – The order in which you added them to the Routes collection. – Any default values that you have provided for a route. – Any constraints that you have provided for a route. – Whether you have defined routing to handle requests that match a physical file.
  • 20. What is a model • The model should contain all of the application business logic, validation logic, and database access logic. • Supports a code first model using the Entity Framework (EF) • All .edmx files, .dbml files etc. should be located in the Models folder.
  • 21. Custom view model • When you combine properties to display on a View Similar problem with ASP.NET Webforms…
  • 22. View
  • 23. What is a View     Most of the Controller Actions return views The path to the view is inferred from the name of the controller and the name of the controller action.  ViewsControllerNameControllerAction.aspx A view is a standard (X)HTML document that can contain scripts. script delimiters <% and %> in the views
  • 24. Passing data to a view  With ViewData:  ViewData["message"] = "Hello World!";  Strongly typed ViewData: ViewData.Model = OurModel;  With ViewBag:  ViewBag.Message = "Hello World!";
  • 25. Post data to a controller • Verb Attributes • The action method in the controller accepts the values posted from the view. • The view form fields must match the same names in the controller. [HttpPost] public ActionResult Edit(Meeting meeting) { if (ModelState.IsValid) { db.Entry(movie).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(meeting); }
  • 27. What is a controller • It’s a class derived from System.Web.MVC.Controller class • Generate the response to the browser request public class HomeController : Controller { public ActionResult Index() { ViewBag.Message = "Welcome to ASP.NET MVC!"; return View(); } public ActionResult About() { return View(); } }
  • 28. Controller actions     Public method of the Controller class Cannot be overloaded Cannot be a static method Returns action result public class HomeController : Controller { public ActionResult Index() { ViewBag.Message = "Welcome to ASP.NET MVC!"; return View(); } public ActionResult About() { return View(); } }
  • 29. Other Features • • • • Scaffolding Test Driven Development Internationalization Many More
  • 31. MVC best practice #1 Delete AccountController.cs Why • You will probably never use these account management pages • Keeping demo code in production application is not a good practice
  • 32. MVC best practice #2 • Isolate controller from the external world – HTTPContext – Data access classes – Configuration management – Logging – Etc.. Why • Increases testability of your application • Increases flexibility of your application
  • 33. View best practice #3 Avoid “magic strings” A magic string is an input that a programmer believes will never come externally and which activates hidden functionality. A user would likely provide input that gives unexpected responses in most situations. However, if the user innocently provides a predefined input, invoking external functionality, the program response is unexpected (“it’s magic”) What should you do • Avoid using ViewData*“key”+ • Always create a ViewModel for each View and inherit from “System.Web.MVC.ViewPage<ListViewModel>
  • 34. MVC best practice #4 Get creative and personalize your experience What should you do • ASP.NET MVC is the base on which to build your own reference architecture • Controllers and views inherit from your own base class • Always create a ViewModel for each View and inherit from “System.Web.MVC.ViewPage<ListViewModel>
  • 35. MVC best practice #5 Choose your view engine carefully What’s a view engine? A view engine is responsible for rendering HTML from your views to the browser. Why? • Default is WebFormViewEngine and may not be the best • Choose the one that makes the most sense for you View Engine Description Razor The Razor view engine is an advanced view engine from Microsoft. Razor using an @ character instead of aspx's <% %> and Razor does not require you to explicitly close the code-block, this view engine is parsed intelligently by the run-time to determine what is a presentation element and what is a code element. ASPX The syntax for writing views with this engine is the same syntax that the ASP.NET Web Forms uses and the file extensions are also taken from ASP.NET Web Form (.aspx, .ascx, .master) . The coding will give us the memory of legacy ASP style. And many more….
  • 36. MVC best practice #6 Avoid logic in your views What can you do • While it is allowed to have “if” and “For Each” when possible hide them in an HTMLHelper • Represents support for rendering HTML controls in a view • Just a string that returns a string that can represent any type of content that you want • MVC Framework includes standard HTML helpers • HTML.ActionLink() • HTML.TextArea • HTML.BeginForm() • HTML.TextBox • HTML.Checkbox() • HTML.Dropdown() • HTML.EndForm • HTML.Hidden • HTML.ListBox • HTML.Password() • HTML.RadioButton
  • 37. MVC Best Practice #7 When an ASP.NET MVC Web application runs in IIS 7.0, no file name extension is required for MVC projects. However, in IIS 6.0, the handler requires that you map the .mvc file name extension to the ASP.NET ISAPI DLL.
  • 38. MVC best practice #8 Pay attention to verbs What happens when you refresh or submit a form? Leverage the Post/Redirect/Get (PRG) Patter • View sends data in POST • Modify data in POST • Controller validates • Renders the View with errors (POST) • Redirect in GET • View renders the results in GET • Show data in GET
  • 39. Wrap up… • MVC is not the only solution but becoming increasingly the answer • VS 2013 has MVC 5 ready to go
  • 40. Who are we? Kentico CMS is one of the most powerful Customer Experience Management Systems and Content Management Systems on the planet. With over 16,000 web sites in 90 countries it is used for everything from simple web sites to complex applications. Kentico CMS is easy to install, simple to manage and reliable.