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;
}
}
Ad

More Related Content

What's hot (20)

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
Mvc4
Muhammad Younis
 
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 S
 
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 MVC
Sagar 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
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
Ashton Feller
 
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
 
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
 
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 S
 
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 MVC
Sagar 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
micham
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
 
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins
 
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
 

Similar to Asp 1a-aspnetmvc (20)

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
 
Mvc
MvcMvc
Mvc
Furqan Ashraf
 
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 Introduction
Sumit Chhabra
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
Hiep Luong
 
CG_CS25010_Lecture
CG_CS25010_LectureCG_CS25010_Lecture
CG_CS25010_Lecture
Connor Goddard
 
Session 1
Session 1Session 1
Session 1
Asif Atick
 
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-phpapp01
Jennie Gajjar
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
baabtra.com - No. 1 supplier of quality freshers
 
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
 
Spring Web Presentation 123143242341234234
Spring Web Presentation 123143242341234234Spring Web Presentation 123143242341234234
Spring Web Presentation 123143242341234234
horiadobrin
 
What is ASP.NET MVC
What is ASP.NET MVCWhat is ASP.NET MVC
What is ASP.NET MVC
Brad Oyler
 
Ad

More from Fajar Baskoro (20)

Sosialisasi Program Digital Skills Unicef 2025.pptx
Sosialisasi Program Digital Skills Unicef  2025.pptxSosialisasi Program Digital Skills Unicef  2025.pptx
Sosialisasi Program Digital Skills Unicef 2025.pptx
Fajar Baskoro
 
DIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdf
DIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdfDIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdf
DIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdf
Fajar Baskoro
 
Digital Skills - 2025 - Dinas - Green Marketplace.pdf
Digital Skills - 2025 - Dinas - Green Marketplace.pdfDigital Skills - 2025 - Dinas - Green Marketplace.pdf
Digital Skills - 2025 - Dinas - Green Marketplace.pdf
Fajar Baskoro
 
Pemrograman Mobile menggunakan kotlin2.pdf
Pemrograman Mobile menggunakan kotlin2.pdfPemrograman Mobile menggunakan kotlin2.pdf
Pemrograman Mobile menggunakan kotlin2.pdf
Fajar Baskoro
 
Membangun Kewirausahan Sosial Program Double Track.pptx
Membangun Kewirausahan Sosial Program Double Track.pptxMembangun Kewirausahan Sosial Program Double Track.pptx
Membangun Kewirausahan Sosial Program Double Track.pptx
Fajar Baskoro
 
Membangun Kemandirian DTMandiri-2025.pptx
Membangun Kemandirian DTMandiri-2025.pptxMembangun Kemandirian DTMandiri-2025.pptx
Membangun Kemandirian DTMandiri-2025.pptx
Fajar Baskoro
 
Panduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdf
Panduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdfPanduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdf
Panduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdf
Fajar Baskoro
 
JADWAL SISTEM PENERIMAAN MURID BARU 2025.pdf
JADWAL SISTEM PENERIMAAN MURID BARU 2025.pdfJADWAL SISTEM PENERIMAAN MURID BARU 2025.pdf
JADWAL SISTEM PENERIMAAN MURID BARU 2025.pdf
Fajar Baskoro
 
Seleksi Penerimaan Murid Baru 2025.pptx
Seleksi Penerimaan Murid Baru  2025.pptxSeleksi Penerimaan Murid Baru  2025.pptx
Seleksi Penerimaan Murid Baru 2025.pptx
Fajar Baskoro
 
Pengembangan Program Dual Track 2025-2.pptx
Pengembangan Program Dual Track 2025-2.pptxPengembangan Program Dual Track 2025-2.pptx
Pengembangan Program Dual Track 2025-2.pptx
Fajar Baskoro
 
Pengembangan Program Dual Track 2025-1.pptx
Pengembangan Program Dual Track 2025-1.pptxPengembangan Program Dual Track 2025-1.pptx
Pengembangan Program Dual Track 2025-1.pptx
Fajar Baskoro
 
PETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdf
PETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdfPETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdf
PETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdf
Fajar Baskoro
 
Pengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptx
Pengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptxPengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptx
Pengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptx
Fajar Baskoro
 
PERFECT SMK 6 - Strategi Pelaksanaan.pptx
PERFECT SMK 6 - Strategi Pelaksanaan.pptxPERFECT SMK 6 - Strategi Pelaksanaan.pptx
PERFECT SMK 6 - Strategi Pelaksanaan.pptx
Fajar Baskoro
 
Program Dual Track Kalimantan Timur 2025.pptx
Program Dual Track Kalimantan Timur 2025.pptxProgram Dual Track Kalimantan Timur 2025.pptx
Program Dual Track Kalimantan Timur 2025.pptx
Fajar Baskoro
 
Contoh Proposal konveksi untuk Program Magang Kewirausahaan.pdf
Contoh Proposal konveksi untuk Program Magang Kewirausahaan.pdfContoh Proposal konveksi untuk Program Magang Kewirausahaan.pdf
Contoh Proposal konveksi untuk Program Magang Kewirausahaan.pdf
Fajar Baskoro
 
Pengembangan Program Digital Skills - 2025.pptx
Pengembangan Program Digital Skills - 2025.pptxPengembangan Program Digital Skills - 2025.pptx
Pengembangan Program Digital Skills - 2025.pptx
Fajar Baskoro
 
PPT-Proyek Magang Kewirausahaan Double Track.pptx
PPT-Proyek Magang Kewirausahaan Double Track.pptxPPT-Proyek Magang Kewirausahaan Double Track.pptx
PPT-Proyek Magang Kewirausahaan Double Track.pptx
Fajar Baskoro
 
PPT-Pembinaan Karir Alumni DT melalui DTPLUSK.pptx
PPT-Pembinaan Karir Alumni DT melalui  DTPLUSK.pptxPPT-Pembinaan Karir Alumni DT melalui  DTPLUSK.pptx
PPT-Pembinaan Karir Alumni DT melalui DTPLUSK.pptx
Fajar Baskoro
 
2-Materi Perencanaan dan Pengelolaan Produk.pptx
2-Materi Perencanaan dan Pengelolaan Produk.pptx2-Materi Perencanaan dan Pengelolaan Produk.pptx
2-Materi Perencanaan dan Pengelolaan Produk.pptx
Fajar Baskoro
 
Sosialisasi Program Digital Skills Unicef 2025.pptx
Sosialisasi Program Digital Skills Unicef  2025.pptxSosialisasi Program Digital Skills Unicef  2025.pptx
Sosialisasi Program Digital Skills Unicef 2025.pptx
Fajar Baskoro
 
DIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdf
DIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdfDIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdf
DIGITAL SKILLS PROGRAMME 2025 - VERSI HZ.pdf
Fajar Baskoro
 
Digital Skills - 2025 - Dinas - Green Marketplace.pdf
Digital Skills - 2025 - Dinas - Green Marketplace.pdfDigital Skills - 2025 - Dinas - Green Marketplace.pdf
Digital Skills - 2025 - Dinas - Green Marketplace.pdf
Fajar Baskoro
 
Pemrograman Mobile menggunakan kotlin2.pdf
Pemrograman Mobile menggunakan kotlin2.pdfPemrograman Mobile menggunakan kotlin2.pdf
Pemrograman Mobile menggunakan kotlin2.pdf
Fajar Baskoro
 
Membangun Kewirausahan Sosial Program Double Track.pptx
Membangun Kewirausahan Sosial Program Double Track.pptxMembangun Kewirausahan Sosial Program Double Track.pptx
Membangun Kewirausahan Sosial Program Double Track.pptx
Fajar Baskoro
 
Membangun Kemandirian DTMandiri-2025.pptx
Membangun Kemandirian DTMandiri-2025.pptxMembangun Kemandirian DTMandiri-2025.pptx
Membangun Kemandirian DTMandiri-2025.pptx
Fajar Baskoro
 
Panduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdf
Panduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdfPanduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdf
Panduan Entry Nilai Rapor untuk Operator SD_MI 2025.pptx (1).pdf
Fajar Baskoro
 
JADWAL SISTEM PENERIMAAN MURID BARU 2025.pdf
JADWAL SISTEM PENERIMAAN MURID BARU 2025.pdfJADWAL SISTEM PENERIMAAN MURID BARU 2025.pdf
JADWAL SISTEM PENERIMAAN MURID BARU 2025.pdf
Fajar Baskoro
 
Seleksi Penerimaan Murid Baru 2025.pptx
Seleksi Penerimaan Murid Baru  2025.pptxSeleksi Penerimaan Murid Baru  2025.pptx
Seleksi Penerimaan Murid Baru 2025.pptx
Fajar Baskoro
 
Pengembangan Program Dual Track 2025-2.pptx
Pengembangan Program Dual Track 2025-2.pptxPengembangan Program Dual Track 2025-2.pptx
Pengembangan Program Dual Track 2025-2.pptx
Fajar Baskoro
 
Pengembangan Program Dual Track 2025-1.pptx
Pengembangan Program Dual Track 2025-1.pptxPengembangan Program Dual Track 2025-1.pptx
Pengembangan Program Dual Track 2025-1.pptx
Fajar Baskoro
 
PETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdf
PETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdfPETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdf
PETUNJUK PELAKSANAAN TEKNIS FESV RAMADHAN 2025.pdf
Fajar Baskoro
 
Pengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptx
Pengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptxPengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptx
Pengembangan Entrepreneur Vokasi Melalui PERFECT SMK-Society 50 .pptx
Fajar Baskoro
 
PERFECT SMK 6 - Strategi Pelaksanaan.pptx
PERFECT SMK 6 - Strategi Pelaksanaan.pptxPERFECT SMK 6 - Strategi Pelaksanaan.pptx
PERFECT SMK 6 - Strategi Pelaksanaan.pptx
Fajar Baskoro
 
Program Dual Track Kalimantan Timur 2025.pptx
Program Dual Track Kalimantan Timur 2025.pptxProgram Dual Track Kalimantan Timur 2025.pptx
Program Dual Track Kalimantan Timur 2025.pptx
Fajar Baskoro
 
Contoh Proposal konveksi untuk Program Magang Kewirausahaan.pdf
Contoh Proposal konveksi untuk Program Magang Kewirausahaan.pdfContoh Proposal konveksi untuk Program Magang Kewirausahaan.pdf
Contoh Proposal konveksi untuk Program Magang Kewirausahaan.pdf
Fajar Baskoro
 
Pengembangan Program Digital Skills - 2025.pptx
Pengembangan Program Digital Skills - 2025.pptxPengembangan Program Digital Skills - 2025.pptx
Pengembangan Program Digital Skills - 2025.pptx
Fajar Baskoro
 
PPT-Proyek Magang Kewirausahaan Double Track.pptx
PPT-Proyek Magang Kewirausahaan Double Track.pptxPPT-Proyek Magang Kewirausahaan Double Track.pptx
PPT-Proyek Magang Kewirausahaan Double Track.pptx
Fajar Baskoro
 
PPT-Pembinaan Karir Alumni DT melalui DTPLUSK.pptx
PPT-Pembinaan Karir Alumni DT melalui  DTPLUSK.pptxPPT-Pembinaan Karir Alumni DT melalui  DTPLUSK.pptx
PPT-Pembinaan Karir Alumni DT melalui DTPLUSK.pptx
Fajar Baskoro
 
2-Materi Perencanaan dan Pengelolaan Produk.pptx
2-Materi Perencanaan dan Pengelolaan Produk.pptx2-Materi Perencanaan dan Pengelolaan Produk.pptx
2-Materi Perencanaan dan Pengelolaan Produk.pptx
Fajar Baskoro
 
Ad

Recently uploaded (20)

Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
High Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptxHigh Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptx
Ayush Srivastava
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-26-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-26-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-26-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-26-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Fundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic CommunicationsFundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic Communications
Jordan Williams
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearVitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
ARUN KUMAR
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Studying Drama: Definition, types and elements
Studying Drama: Definition, types and elementsStudying Drama: Definition, types and elements
Studying Drama: Definition, types and elements
AbdelFattahAdel2
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
High Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptxHigh Performance Liquid Chromatography .pptx
High Performance Liquid Chromatography .pptx
Ayush Srivastava
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Fundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic CommunicationsFundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic Communications
Jordan Williams
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearVitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd year
ARUN KUMAR
 
Studying Drama: Definition, types and elements
Studying Drama: Definition, types and elementsStudying Drama: Definition, types and elements
Studying Drama: Definition, types and elements
AbdelFattahAdel2
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 

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; } }