SlideShare a Scribd company logo
ASP.NET MVC
1
MVC
•NET Framework – A technology introduced in 2002
which includes the ability to create executables,
web applications, and services using C#
(pronounced see-sharp), Visual Basic, and F#.
•ASP.NET – An open-source server-side web
application framework which is a subset of
Microsoft’s .NET framework. Their first iteration of
ASP.NET included a technology called Web Forms.
•ASP.NET WebForms – (2002 – current) A
proprietary technique developed by Microsoft to
manage state and form data across multiple pages.
2
MVC
•ASP.NET MVC is Microsoft’s framework for
developing fast web applications using their .NET
platform with either the C# or VB.NET language.
•MVC is an acronym that stands for:
• (M)odel – Objects that hold your data.
• (V)iew – Views that are presented to your users,
usually HTML pages or pieces of HTML.
• (C)ontroller – Controllers are what orchestrates the
retrieving and saving of data, populating models, and
receiving data from the users.
3
MVC
•An alternative to ASP .NET Web Forms
•Presentation framework
• Lightweight
• Highly testable
•Integrated with the existing ASP .NET features:
• Master pages
• Membership-Based Authentication
4
ASP .NET MVC Framework Components
• Models
• Business/domain logic
• Model objects, retrieve and store model state in a
persistent storage (database).
• Views
• Display application’s UI
• UI created from the model data
• Controllers
• Handle user input and interaction
• Work with model
• Select a view for rendering UI
5
Advantages of MVC
•Advantages:
• Easier to manage complexity (divide and conquer)
• It does not use server forms and view state
• Front Controller pattern (rich routing)
• Better support for test-driven development
• Ideal for distributed and large teams
• High degree of control over the application behavior
6
Advantages of MVC
ASP.NET MVC has a separation of concerns.
Separation of concerns means that your business
logic is not contained in a View or controller. The
business logic should be found in the models of your
application. This makes web development even
easier because it allows you to focus on integrating
your business rules into reusable models.
7
Advantages of MVC
ASP.NET MVC provides testability out of the box.
Another selling point is that ASP.NET MVC allows
you to test every single one of your components,
thereby making your code almost bulletproof. The
more unit tests you provide for your application, the
more durable your application will become.
8
Advantages of MVC
ASP.NET MVC has a smaller “View” footprint.
With WebForms, there is a server variable called
ViewState that tracks all of the controls on a page. If
you have a ton of controls on your WebForm, the
ViewState can grow to become an issue. ASP.NET
MVC doesn’t have a ViewState, thus making the
View lean and mean.
9
Advantages of MVC
ASP.NET MVC has more control over HTML.
Since server-side controls aren’t used, the View can
be as small as you want it to be. It provides a better
granularity and control over how you want your
pages rendered in the browser.
10
ASP .NET MVC Features
•Separation of application tasks
• Input logic, business logic, UI logic
•Support for test-driven development
• Unit testing
• No need to start app server
•Extensible and pluggable framework
• Components easily replaceable or customized(view
engine, URL routing, data serialization,…)
11
ASP .NET MVC App Structure
•URLs mapped to controller classes
•Controller
• handles requests,
• executes appropriate logic and
• calls a View to generate HTML response
•URL routing
• ASP .NET routing engine (flexible mapping)
• Support for defining customized routing rules
• Automatic passing/parsing of parameters
12
ASP .NET MVC App Structure
•No Postbackinteraction!
•All user interactions routed to a controller
•No view state and page lifecycle events
13
Layout of an MVC project
When you create a new MVC project, your solution
should have the following structure in your Solution
Explorer.
14
Layout of an MVC project
15
Layout of an MVC project
16
• App_Data – While I don’t use this folder often, it’s meant to hold
data for your application (just as the name says). A couple of
examples would include a portable database (like SQL Server
Compact Edition) or any kind of data files (XML, JSON, etc.). I prefer
to use SQL Server.
• App_Start – The App_Start folder contains the initialization and
configuration of different features of your application.
• BundleConfig.cs – This contains all of the configuration for minifying and
compressing your JavaScript and CSS files into one file.
• FilterConfig.cs – Registers Global Filters.
• RouteConfig.cs – Configuration of your routes.
There are other xxxxConfig.cs files that are added when you apply other MVC-
related technologies (for example, WebAPI adds WebApiConfig.cs).
• Content – This folder is meant for all of your static content like
images and style sheets. It’s best to create folders for them like
“images” or “styles” or “css”.
Layout of an MVC project
17
• Controllers – The controllers folder is where we place the
controllers.
• Models – This folder contains your business models. It’s
better when you have these models in another project, but
for demo purposes, we’ll place them in here.
• Scripts – This is where your JavaScript scripts reside.
• Views – This parent folder contains all of your HTML “Views”
with each controller name as a folder. Each folder will
contain a number of cshtml files relating to the methods in
that folder’s controller. If we had a URL that looked like this:
http://www.xyzcompany.com/Products/List
we would have a Products folder with a List.cshtml file.
We would also know to look in the Controllers folder and
open the ProductsController.cs and look for the List
method.
Layout of an MVC project
18
• Views/Shared – The Shared folder is meant for any shared
cshtml files you need across the website.
• Global.asax – The Global.asax is meant for the initialization
of the web application. If you look inside the Global.asax,
you’ll notice that this is where the RouteConfig.cs,
BundleConfig.cs, and FilterConfig.cs are called when the
application runs.
• Web.Config – The web.config is where you place
configuration settings for your application. For new MVC
developers, it’s good to know that you can place settings
inside the <appsettings> tag and place connection strings
inside the <connectionstring> tag.
Now that you know where everything is located in your
project, we can move forward with what is the process
when an MVC application is initially called.
MVC App Execution
19
• Entry points to MVC:
• UrlRoutingModuleand MvcRouteHandler
• Request handling:
• Select appropriate controller
• Obtain a specific controller instance
• Call the controller’s Execute method
• Receive first request for the application
• Populating RouteTable
• Perform routing
• Create MVC Request handler
• Create controller
• Execute controller
MVC App Execution
20
• Invoke action
• Execute result
• ViewResult, RedirectToRouteResult, ContentResult,
FileResult, JsonResult, RedirectResult
Models
21
• Models are probably the easiest section to address first.
Models are the objects that define and store your data so
you can use them throughout the application.
• Models to be the equivalent of plain old CLR (Common
Language Runtime) objects, or POCO’s. A POCO is a plain
class that holds structured data.
• one simple POCO (or model) would be similar to:
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Company { get; set; }
public IEnumerable<Order> Orders { get; set;
}
Models
22
Your business Model may look something like this:
public class Customer
{ public string FirstName { get; set; }
public string LastName { get; set; }
public string Company { get; set; }
public IEnumerable<Order> Orders { get; set; }
public DateTime FirstMet { get; set; }
public int CalculateAge(DateTime endTime)
{ var age = endTime.Year - FirstMet.Year;
if (endTime < FirstMet.AddYears(age))
age--;
return age;
}
}

More Related Content

What's hot

ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Sitecore MVC (User Group Conference, May 23rd 2014)
Sitecore MVC (User Group Conference, May 23rd 2014)Sitecore MVC (User Group Conference, May 23rd 2014)
Sitecore MVC (User Group Conference, May 23rd 2014)
Ruud van Falier
 
Mvc4
Mvc4Mvc4
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
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
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVCSagar Kamate
 
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
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
Divya Sharma
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
Nilachal sethi
 
Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvc
micham
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
Taranjeet Singh
 
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
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
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
 

What's hot (20)

ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Sitecore MVC (User Group Conference, May 23rd 2014)
Sitecore MVC (User Group Conference, May 23rd 2014)Sitecore MVC (User Group Conference, May 23rd 2014)
Sitecore MVC (User Group Conference, May 23rd 2014)
 
Mvc4
Mvc4Mvc4
Mvc4
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
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
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
Introduction to ASP.Net MVC
Introduction to ASP.Net MVCIntroduction to ASP.Net MVC
Introduction to ASP.Net MVC
 
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
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
ASP .Net MVC 5
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
 
Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvc
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
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
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
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
 

Similar to Asp 1a-aspnetmvc

Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
Fajar Baskoro
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
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
 
ASP.Net | Sabin Saleem
ASP.Net | Sabin SaleemASP.Net | Sabin Saleem
ASP.Net | Sabin Saleem
SaBin SaleEm
 
ASP.NET MVC Introduction
ASP.NET MVC IntroductionASP.NET MVC Introduction
ASP.NET MVC IntroductionSumit Chhabra
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
Hiep Luong
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
rainynovember12
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
Malisa Ncube
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
Prashant Kumar
 
Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Jennie Gajjar
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdf
Lê Thưởng
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sirwan Afifi
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
pratik satikunvar
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVC
Brad Oyler
 
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
 

Similar to Asp 1a-aspnetmvc (20)

Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 
Mvc
MvcMvc
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
 
ASP.Net | Sabin Saleem
ASP.Net | Sabin SaleemASP.Net | Sabin Saleem
ASP.Net | Sabin Saleem
 
ASP.NET MVC Introduction
ASP.NET MVC IntroductionASP.NET MVC Introduction
ASP.NET MVC Introduction
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
CG_CS25010_Lecture
CG_CS25010_LectureCG_CS25010_Lecture
CG_CS25010_Lecture
 
Session 1
Session 1Session 1
Session 1
 
Mvc Brief Overview
Mvc Brief OverviewMvc Brief Overview
Mvc Brief Overview
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
 
Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdf
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Sitecore mvc
Sitecore mvcSitecore mvc
Sitecore mvc
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVC
 
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
 

More from Fajar Baskoro

Generasi Terampil Digital Skill-2023.pptx
Generasi Terampil Digital Skill-2023.pptxGenerasi Terampil Digital Skill-2023.pptx
Generasi Terampil Digital Skill-2023.pptx
Fajar Baskoro
 
Cara Membuat Kursus Online Wordpress-tutorstarter
Cara Membuat Kursus Online Wordpress-tutorstarterCara Membuat Kursus Online Wordpress-tutorstarter
Cara Membuat Kursus Online Wordpress-tutorstarter
Fajar Baskoro
 
PPT-Kick Off Double Track 2024 melaksanakan Festival Ramadhan
PPT-Kick Off Double Track 2024 melaksanakan Festival RamadhanPPT-Kick Off Double Track 2024 melaksanakan Festival Ramadhan
PPT-Kick Off Double Track 2024 melaksanakan Festival Ramadhan
Fajar Baskoro
 
Buku Inovasi 2023 - 2024 konsep capaian KUS
Buku Inovasi 2023 - 2024 konsep capaian  KUSBuku Inovasi 2023 - 2024 konsep capaian  KUS
Buku Inovasi 2023 - 2024 konsep capaian KUS
Fajar Baskoro
 
Pemaparan Sosialisasi Program Dual Track 2024.pptx
Pemaparan Sosialisasi Program Dual Track 2024.pptxPemaparan Sosialisasi Program Dual Track 2024.pptx
Pemaparan Sosialisasi Program Dual Track 2024.pptx
Fajar Baskoro
 
Executive Millennial Entrepreneur Award 2023-1a-1.pdf
Executive Millennial Entrepreneur Award  2023-1a-1.pdfExecutive Millennial Entrepreneur Award  2023-1a-1.pdf
Executive Millennial Entrepreneur Award 2023-1a-1.pdf
Fajar Baskoro
 
1-Executive Millennial Entrepreneur Award 2023-1-cetak.pptx
1-Executive Millennial Entrepreneur Award  2023-1-cetak.pptx1-Executive Millennial Entrepreneur Award  2023-1-cetak.pptx
1-Executive Millennial Entrepreneur Award 2023-1-cetak.pptx
Fajar Baskoro
 
Executive Millennial Entrepreneur Award 2023-1.pptx
Executive Millennial Entrepreneur Award  2023-1.pptxExecutive Millennial Entrepreneur Award  2023-1.pptx
Executive Millennial Entrepreneur Award 2023-1.pptx
Fajar Baskoro
 
Pemrograman Mobile - JetPack Compose1.pptx
Pemrograman Mobile - JetPack Compose1.pptxPemrograman Mobile - JetPack Compose1.pptx
Pemrograman Mobile - JetPack Compose1.pptx
Fajar Baskoro
 
Evaluasi KPP Program Dual Track Provinsi Kaltim
Evaluasi KPP Program Dual Track Provinsi KaltimEvaluasi KPP Program Dual Track Provinsi Kaltim
Evaluasi KPP Program Dual Track Provinsi Kaltim
Fajar Baskoro
 
foto tenda digital skill program dari sekolah
foto tenda digital skill program dari sekolahfoto tenda digital skill program dari sekolah
foto tenda digital skill program dari sekolah
Fajar Baskoro
 
Meraih Peluang di Gig Economy yang cocok bagi remaja
Meraih Peluang di Gig Economy yang cocok bagi remajaMeraih Peluang di Gig Economy yang cocok bagi remaja
Meraih Peluang di Gig Economy yang cocok bagi remaja
Fajar Baskoro
 
Membangun aplikasi mobile dengan Appsheet
Membangun aplikasi mobile dengan AppsheetMembangun aplikasi mobile dengan Appsheet
Membangun aplikasi mobile dengan Appsheet
Fajar Baskoro
 
epl1.pdf
epl1.pdfepl1.pdf
epl1.pdf
Fajar Baskoro
 
user.docx
user.docxuser.docx
user.docx
Fajar Baskoro
 
Dtmart.pptx
Dtmart.pptxDtmart.pptx
Dtmart.pptx
Fajar Baskoro
 
DualTrack-2023.pptx
DualTrack-2023.pptxDualTrack-2023.pptx
DualTrack-2023.pptx
Fajar Baskoro
 
BADGE.pptx
BADGE.pptxBADGE.pptx
BADGE.pptx
Fajar Baskoro
 
womenatwork.pdf
womenatwork.pdfwomenatwork.pdf
womenatwork.pdf
Fajar Baskoro
 
Transition education to employment.pdf
Transition education to employment.pdfTransition education to employment.pdf
Transition education to employment.pdf
Fajar Baskoro
 

More from Fajar Baskoro (20)

Generasi Terampil Digital Skill-2023.pptx
Generasi Terampil Digital Skill-2023.pptxGenerasi Terampil Digital Skill-2023.pptx
Generasi Terampil Digital Skill-2023.pptx
 
Cara Membuat Kursus Online Wordpress-tutorstarter
Cara Membuat Kursus Online Wordpress-tutorstarterCara Membuat Kursus Online Wordpress-tutorstarter
Cara Membuat Kursus Online Wordpress-tutorstarter
 
PPT-Kick Off Double Track 2024 melaksanakan Festival Ramadhan
PPT-Kick Off Double Track 2024 melaksanakan Festival RamadhanPPT-Kick Off Double Track 2024 melaksanakan Festival Ramadhan
PPT-Kick Off Double Track 2024 melaksanakan Festival Ramadhan
 
Buku Inovasi 2023 - 2024 konsep capaian KUS
Buku Inovasi 2023 - 2024 konsep capaian  KUSBuku Inovasi 2023 - 2024 konsep capaian  KUS
Buku Inovasi 2023 - 2024 konsep capaian KUS
 
Pemaparan Sosialisasi Program Dual Track 2024.pptx
Pemaparan Sosialisasi Program Dual Track 2024.pptxPemaparan Sosialisasi Program Dual Track 2024.pptx
Pemaparan Sosialisasi Program Dual Track 2024.pptx
 
Executive Millennial Entrepreneur Award 2023-1a-1.pdf
Executive Millennial Entrepreneur Award  2023-1a-1.pdfExecutive Millennial Entrepreneur Award  2023-1a-1.pdf
Executive Millennial Entrepreneur Award 2023-1a-1.pdf
 
1-Executive Millennial Entrepreneur Award 2023-1-cetak.pptx
1-Executive Millennial Entrepreneur Award  2023-1-cetak.pptx1-Executive Millennial Entrepreneur Award  2023-1-cetak.pptx
1-Executive Millennial Entrepreneur Award 2023-1-cetak.pptx
 
Executive Millennial Entrepreneur Award 2023-1.pptx
Executive Millennial Entrepreneur Award  2023-1.pptxExecutive Millennial Entrepreneur Award  2023-1.pptx
Executive Millennial Entrepreneur Award 2023-1.pptx
 
Pemrograman Mobile - JetPack Compose1.pptx
Pemrograman Mobile - JetPack Compose1.pptxPemrograman Mobile - JetPack Compose1.pptx
Pemrograman Mobile - JetPack Compose1.pptx
 
Evaluasi KPP Program Dual Track Provinsi Kaltim
Evaluasi KPP Program Dual Track Provinsi KaltimEvaluasi KPP Program Dual Track Provinsi Kaltim
Evaluasi KPP Program Dual Track Provinsi Kaltim
 
foto tenda digital skill program dari sekolah
foto tenda digital skill program dari sekolahfoto tenda digital skill program dari sekolah
foto tenda digital skill program dari sekolah
 
Meraih Peluang di Gig Economy yang cocok bagi remaja
Meraih Peluang di Gig Economy yang cocok bagi remajaMeraih Peluang di Gig Economy yang cocok bagi remaja
Meraih Peluang di Gig Economy yang cocok bagi remaja
 
Membangun aplikasi mobile dengan Appsheet
Membangun aplikasi mobile dengan AppsheetMembangun aplikasi mobile dengan Appsheet
Membangun aplikasi mobile dengan Appsheet
 
epl1.pdf
epl1.pdfepl1.pdf
epl1.pdf
 
user.docx
user.docxuser.docx
user.docx
 
Dtmart.pptx
Dtmart.pptxDtmart.pptx
Dtmart.pptx
 
DualTrack-2023.pptx
DualTrack-2023.pptxDualTrack-2023.pptx
DualTrack-2023.pptx
 
BADGE.pptx
BADGE.pptxBADGE.pptx
BADGE.pptx
 
womenatwork.pdf
womenatwork.pdfwomenatwork.pdf
womenatwork.pdf
 
Transition education to employment.pdf
Transition education to employment.pdfTransition education to employment.pdf
Transition education to employment.pdf
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 

Asp 1a-aspnetmvc

  • 2. MVC •NET Framework – A technology introduced in 2002 which includes the ability to create executables, web applications, and services using C# (pronounced see-sharp), Visual Basic, and F#. •ASP.NET – An open-source server-side web application framework which is a subset of Microsoft’s .NET framework. Their first iteration of ASP.NET included a technology called Web Forms. •ASP.NET WebForms – (2002 – current) A proprietary technique developed by Microsoft to manage state and form data across multiple pages. 2
  • 3. MVC •ASP.NET MVC is Microsoft’s framework for developing fast web applications using their .NET platform with either the C# or VB.NET language. •MVC is an acronym that stands for: • (M)odel – Objects that hold your data. • (V)iew – Views that are presented to your users, usually HTML pages or pieces of HTML. • (C)ontroller – Controllers are what orchestrates the retrieving and saving of data, populating models, and receiving data from the users. 3
  • 4. MVC •An alternative to ASP .NET Web Forms •Presentation framework • Lightweight • Highly testable •Integrated with the existing ASP .NET features: • Master pages • Membership-Based Authentication 4
  • 5. ASP .NET MVC Framework Components • Models • Business/domain logic • Model objects, retrieve and store model state in a persistent storage (database). • Views • Display application’s UI • UI created from the model data • Controllers • Handle user input and interaction • Work with model • Select a view for rendering UI 5
  • 6. Advantages of MVC •Advantages: • Easier to manage complexity (divide and conquer) • It does not use server forms and view state • Front Controller pattern (rich routing) • Better support for test-driven development • Ideal for distributed and large teams • High degree of control over the application behavior 6
  • 7. Advantages of MVC ASP.NET MVC has a separation of concerns. Separation of concerns means that your business logic is not contained in a View or controller. The business logic should be found in the models of your application. This makes web development even easier because it allows you to focus on integrating your business rules into reusable models. 7
  • 8. Advantages of MVC ASP.NET MVC provides testability out of the box. Another selling point is that ASP.NET MVC allows you to test every single one of your components, thereby making your code almost bulletproof. The more unit tests you provide for your application, the more durable your application will become. 8
  • 9. Advantages of MVC ASP.NET MVC has a smaller “View” footprint. With WebForms, there is a server variable called ViewState that tracks all of the controls on a page. If you have a ton of controls on your WebForm, the ViewState can grow to become an issue. ASP.NET MVC doesn’t have a ViewState, thus making the View lean and mean. 9
  • 10. Advantages of MVC ASP.NET MVC has more control over HTML. Since server-side controls aren’t used, the View can be as small as you want it to be. It provides a better granularity and control over how you want your pages rendered in the browser. 10
  • 11. ASP .NET MVC Features •Separation of application tasks • Input logic, business logic, UI logic •Support for test-driven development • Unit testing • No need to start app server •Extensible and pluggable framework • Components easily replaceable or customized(view engine, URL routing, data serialization,…) 11
  • 12. ASP .NET MVC App Structure •URLs mapped to controller classes •Controller • handles requests, • executes appropriate logic and • calls a View to generate HTML response •URL routing • ASP .NET routing engine (flexible mapping) • Support for defining customized routing rules • Automatic passing/parsing of parameters 12
  • 13. ASP .NET MVC App Structure •No Postbackinteraction! •All user interactions routed to a controller •No view state and page lifecycle events 13
  • 14. Layout of an MVC project When you create a new MVC project, your solution should have the following structure in your Solution Explorer. 14
  • 15. Layout of an MVC project 15
  • 16. Layout of an MVC project 16 • App_Data – While I don’t use this folder often, it’s meant to hold data for your application (just as the name says). A couple of examples would include a portable database (like SQL Server Compact Edition) or any kind of data files (XML, JSON, etc.). I prefer to use SQL Server. • App_Start – The App_Start folder contains the initialization and configuration of different features of your application. • BundleConfig.cs – This contains all of the configuration for minifying and compressing your JavaScript and CSS files into one file. • FilterConfig.cs – Registers Global Filters. • RouteConfig.cs – Configuration of your routes. There are other xxxxConfig.cs files that are added when you apply other MVC- related technologies (for example, WebAPI adds WebApiConfig.cs). • Content – This folder is meant for all of your static content like images and style sheets. It’s best to create folders for them like “images” or “styles” or “css”.
  • 17. Layout of an MVC project 17 • Controllers – The controllers folder is where we place the controllers. • Models – This folder contains your business models. It’s better when you have these models in another project, but for demo purposes, we’ll place them in here. • Scripts – This is where your JavaScript scripts reside. • Views – This parent folder contains all of your HTML “Views” with each controller name as a folder. Each folder will contain a number of cshtml files relating to the methods in that folder’s controller. If we had a URL that looked like this: http://www.xyzcompany.com/Products/List we would have a Products folder with a List.cshtml file. We would also know to look in the Controllers folder and open the ProductsController.cs and look for the List method.
  • 18. Layout of an MVC project 18 • Views/Shared – The Shared folder is meant for any shared cshtml files you need across the website. • Global.asax – The Global.asax is meant for the initialization of the web application. If you look inside the Global.asax, you’ll notice that this is where the RouteConfig.cs, BundleConfig.cs, and FilterConfig.cs are called when the application runs. • Web.Config – The web.config is where you place configuration settings for your application. For new MVC developers, it’s good to know that you can place settings inside the <appsettings> tag and place connection strings inside the <connectionstring> tag. Now that you know where everything is located in your project, we can move forward with what is the process when an MVC application is initially called.
  • 19. MVC App Execution 19 • Entry points to MVC: • UrlRoutingModuleand MvcRouteHandler • Request handling: • Select appropriate controller • Obtain a specific controller instance • Call the controller’s Execute method • Receive first request for the application • Populating RouteTable • Perform routing • Create MVC Request handler • Create controller • Execute controller
  • 20. MVC App Execution 20 • Invoke action • Execute result • ViewResult, RedirectToRouteResult, ContentResult, FileResult, JsonResult, RedirectResult
  • 21. Models 21 • Models are probably the easiest section to address first. Models are the objects that define and store your data so you can use them throughout the application. • Models to be the equivalent of plain old CLR (Common Language Runtime) objects, or POCO’s. A POCO is a plain class that holds structured data. • one simple POCO (or model) would be similar to: public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public string Company { get; set; } public IEnumerable<Order> Orders { get; set; }
  • 22. Models 22 Your business Model may look something like this: public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public string Company { get; set; } public IEnumerable<Order> Orders { get; set; } public DateTime FirstMet { get; set; } public int CalculateAge(DateTime endTime) { var age = endTime.Year - FirstMet.Year; if (endTime < FirstMet.AddYears(age)) age--; return age; } }