By 09/02/2016 18 Comments

What is view and model in MVC?

Model:

  • MVC stands for model view and controller.
  • Model contains domain/business/application logic in the form of Object oriented programming pattern (classes). It holds data by using auto-implemented properties.

OR

  • Model also contains database code such as database connectivity code.

Example: UsersInformation.cs model

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Lesson1.Models
{
    public class UsersInformation
    {
        public int id { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }
    }
}


View:

  • Views display/render the model data in the form of G.U.I (Graphical user interface). Views also contains the web controls such as textfields, drop downs, buttons etc. The files in view folder may have cshtml, aspx, html, asp or vbhtml file extensions depends on your language setting environment.


Example: Index.aspx view

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
Date and Time is: <%= ViewData["DateTime"] %> Id: <%= Model.id %> Name: <%= Model.Name %> Id: <%= Model.Surname %>






Posted in: ASP.NET, Solutions

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .