Skip to document

CS 3203 Software Engineering Lab 6

CS 3203 Software Engineering Lab 6
Course

Software Engineering (CS391)

174 Documents
Students shared 174 documents in this course
Academic year: 2021/2022
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
Fayoum University

Comments

Please sign in or register to post comments.

Preview text

ASP MVC

What is ASP MVC?

The ASP MVC is a web application development framework provided by Microsoft which is built on top of the .NET Framework. We can use this ASP MVC Framework to develop web applications that provide a clean separation of code. The ASP MVC Framework is based on MVC (Model-View-Controller) Design Pattern.

What is MVC?

MVC is an architectural software design pattern that is used for developing interactive applications where there would be user interaction involved and based on the user interaction some event handling has occurred. It is not only used for web-based applications, but it can also be used for Desktop or mobile-based applications where there are user interactions involved. MVC design pattern was introduced in the 1970s that basically divides an application into 3 major components such as Model, View, and Controller. The main objective of the MVC design pattern is the separation of concerns, it means the domain model and business logic are separated from the user interface (i., view). Thus, maintenance and testing of the application become simpler and easier.

Model: Model represents shape of the data and business logic. It maintains the data of the

application. Model objects retrieve and store model state in a database. Model is a data and business logic.

View: View is a user interface. View display data using model to the user and enables them

to modify the data. View is a User Interface.

Controller: Controller handles the user request. Typically, user interact with View, which

in-turn raises appropriate URL request, this request will be handled by a controller. The controller renders the appropriate view with the model data as a response (communication between user and model). Controller is a request handler(process).

CS 3203 Software Engineering (1) – 2020/2021 Lab ( 6 )

ASP MVC Folder and File Structure

When we create an ASP MVC 5 application, the Visual Studio by default creates the following folders and files for our application.

App_Data:

The App_Data folder of an MVC application is used to contain the application related data files like .mdf files, LocalDB, and XML files, etc. The most important point that you need to remember is the IIS is never going to serve files from this App_Data folder

App_Start:

The App_Start folder of an MVC application is used to contain the class files which are needed to be executed at the time of application starts. The classes like BundleConfig, FilterConfig, RouteConfig, IdentityConfig, etc. are stored within this folder. So, in the simple word we can say that configuration related class files are stored here.

Content:

The Content Folder of an MVC application is used to store the static files such as the image files, CSS files, and icons files. When we create an MVC 5 application, by default the bootstrap, Site, and bootstrap.min files are included by the visual studio.

Views:

The Views Folder of an MVC application is used to contains the “.cshtml” files for the application. In MVC, the. cshtml file is a file where we need to write the HTML code along with the C# code.

The Views folder in the MVC application includes separate folders for each and every controller for your application. For example, all the. cshtml files of the HomeController will be in the View => Home folder.

Global:

The Global file in an MVC application allows us to write code that we want to run at the application level, such as Application_BeginRequest, application_error, application_start, session_start, session_end, etc.

Packages:

The Packages file in MVC application is managed by the NuGet which will keep track of what packages and versions have installed within your application.

Web:

The Web file of an MVC application is one of the most useful and important files which contains the application-level configurations.

The RouteConfig class file and you will see that the RegisterRoutes() method of the RouteConfig class has got a default route.

Action Results in ASP MVC

In ASP MVC Application, there are many different types of Action Results. Each action result returns a different format of the output. As a programmer, we need to use different action results to get the expected output.

Action Result is a result of action methods or return types of action methods. The action result is an abstract class. It is the base class for all types of action results.

  1. ViewResult – Represents HTML and markup.
  2. EmptyResult – Represents no result.
  3. RedirectResult – Represents a redirection to a new URL.
  4. JsonResult – Represents a JavaScript Object Notation result that can be used in an AJAX application.
  5. JavaScriptResult – Represents a JavaScript script.
  6. ContentResult – Represents a text result.
  7. FileContentResult – Represents a downloadable file (with the binary content).
  8. FilePathResult – Represents a downloadable file (with a path).
  9. FileStreamResult – Represents a downloadable file (with a file stream).
Was this document helpful?

CS 3203 Software Engineering Lab 6

Course: Software Engineering (CS391)

174 Documents
Students shared 174 documents in this course

University: Fayoum University

Was this document helpful?
Eng. Yossr - Eng. Esraa
1
ASP.NET MVC
What is ASP.NET MVC?
The ASP.NET MVC is a web application development framework provided by Microsoft
which is built on top of the .NET Framework. We can use this ASP.NET MVC Framework to
develop web applications that provide a clean separation of code.
The ASP.NET MVC Framework is based on MVC (Model-View-Controller) Design Pattern.
What is MVC?
MVC is an architectural software design pattern that is used for developing interactive
applications where there would be user interaction involved and based on the user
interaction some event handling has occurred. It is not only used for web-based
applications, but it can also be used for Desktop or mobile-based applications where there
are user interactions involved.
MVC design pattern was introduced in the 1970s that basically divides an application into 3
major components such as Model, View, and Controller. The main objective of the MVC
design pattern is the separation of concerns, it means the domain model and business logic
are separated from the user interface (i.e., view). Thus, maintenance and testing of the
application become simpler and easier.
Model: Model represents shape of the data and business logic. It maintains the data of the
application. Model objects retrieve and store model state in a database.
Model is a data and business logic.
View: View is a user interface. View display data using model to the user and enables them
to modify the data.
View is a User Interface.
Controller: Controller handles the user request. Typically, user interact with View, which
in-turn raises appropriate URL request, this request will be handled by a controller. The
controller renders the appropriate view with the model data as a response (communication
between user and model).
Controller is a request handler(process).
CS 3203 Software Engineering (1) 2020/2021
Lab (6)