---
title: "MVC(Model View Controller)"  
description: "Model is used to work with application data it is responsible for maintaining application data and business logic."  
author: "Manish Kumar"  
published: 2017-01-13  
updated: 2019-01-30  
canonical: https://www.mindstick.com/articles/12228/mvc-model-view-controller  
category: "c#"  
tags: ["mvc4"]  
reading_time: 2 minutes  

---

# MVC(Model View Controller)

##### Model

Model is used to work with [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) data it is [responsible](https://answers.mindstick.com/qa/94149/who-is-one-of-the-responsible-person-for-the-department-of-space-dos) for maintaining application data and [business logic](https://answers.mindstick.com/qa/30543/what-is-business-logic). [Model Class](https://www.mindstick.com/forum/2281/filter-objects-inside-model-class-by-date) is kept in the model folder.Model notifies a view for changes(view get data from model).It represents a set of classes that represents the business logic.It is responsible for providing all the business logic and [validation](https://www.mindstick.com/articles/43/validation-controls-in-asp-dot-net) to the view.basically model class include public property which will be used by application for manipulating the data.

```
using System;using
System.Collections.Generic;using System.Linq;using System.Web; namespace
MvcApplication2.Models{    public class Class1    {        public String Name { get; set; }        public String Address { get; set; }        public String Email { get; set; }    }}
```

##### View

View is the [presentation layer](https://answers.mindstick.com/blog/23/drile-down-about-the-presentation-layer-in-osi-model) of our project.The view is only responsible for only displaying the data and data is received from the [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) as the result. The view is defaultly stored in the view folder.in the view basically we use .cshtml file where we write [c#](https://www.mindstick.com/Tag/article/csharp) or vb code. When we create view it something look like this and view is binded through model

```
@model MvcApplication2.Models.Class1@{    Layout = null;} <!DOCTYPE html> <html><head>    <meta name="viewport" content="width=device-width" />    <title>Index</title></head><body>    <div>        <h1>Welcome to the index view</h1>    </div></body></html>
```

##### Controller

\

It act as a mediator between view and model and is responsible for controlling the application logic .It send commands to the model to update the model it can also commands to its associated view to change the view.Controller receives input from the view.then process [user data](https://www.mindstick.com/forum/160424/how-do-bearer-tokens-ensure-the-security-and-confidentiality-of-user-data) with the help of model and passing the results back to the view.it is responsible for controlling the way that a user intracts.it is responsible for what data to be send to user when user request.\

\

```
 using System;using
System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc; namespace
MvcApplication2.Controllers{    public class Default1Controller : Controller    {        //        // GET: /Default1/         public ActionResult Index()        {            return View();        }        public ActionResult About()        {            return View();        }     }}
```

\

here this is default controller inheriting controller [base class](https://www.mindstick.com/blog/116/base-class-initilization).it has two method

\

Index() and About(). with respective view.

## \

---

Original Source: https://www.mindstick.com/articles/12228/mvc-model-view-controller

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
