{"id":5073,"date":"2022-12-27T02:49:22","date_gmt":"2022-12-27T02:49:22","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=5073"},"modified":"2023-06-24T11:41:25","modified_gmt":"2023-06-24T11:41:25","slug":"mvc-code","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/","title":{"rendered":"MVC Code"},"content":{"rendered":"<h2 id=\"database-code\">Database code<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">create database mvc<br\/><br\/>create table tbl_products<br\/>(<br\/>  id int primary key identity(1,1),<br\/>  product_name varchar(100),<br\/>  quantity int<br\/>)<br\/><br\/>insert into tbl_products values (&#039;rice&#039;,100)<br\/><br\/>create procedure get_products<br\/>as begin<br\/>select * from tbl_products<br\/>end<br\/>go<br\/>create procedure insert_products<br\/>(<br\/>@product_name varchar(100),<br\/>@quantity int<br\/>)<br\/>as begin<br\/>insert into tbl_products values<br\/>(@product_name,@quantity)<br\/>end<br\/>insert_products &#039;dhall&#039;,50<br\/><br\/>edit_products 1,&#039;salt&#039;,50<br\/>create procedure edit_products<br\/>(<br\/>@id int,<br\/>@product_name varchar(100),<br\/>@quantity int<br\/>)<br\/>as begin<br\/>update tbl_products set product_name=@product_name<br\/>, quantity=@quantity  where id =@id<br\/>end<br\/><br\/>create procedure delete_products<br\/>(<br\/>@id int<br\/>)<br\/>as begin<br\/>delete from tbl_products where id =@id<br\/>end<br\/><br\/>go<br\/><br\/>create procedure get_products_id<br\/>(@id int<br\/>)<br\/>as begin<br\/>select * from tbl_products where id=@id<br\/>end<\/code><\/pre> <\/div>\n<h2 id=\"model-code\">Model Code<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-cpp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-cpp code-embed-code\">using System;<br\/>using System.Collections.Generic;<br\/>using System.Linq;<br\/>using System.Web;<br\/><br\/>namespace ArunDepartmentalStore.Models<br\/>{<br\/>    public class tbl_products<br\/>    {<br\/>        public int id { get; set; }<br\/>        public string product_name { get; set; }<br\/>        public int quantity { get; set; }<br\/><br\/>    }<br\/>}<\/code><\/pre> <\/div>\n<h2 id=\"controller-code\">Controller Code<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-cpp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-cpp code-embed-code\">using ArunDepartmentalStore.Models;<br\/>using System;<br\/>using System.Collections.Generic;<br\/>using System.Data.SqlClient;<br\/>using System.Linq;<br\/>using System.Web;<br\/>using System.Web.Mvc;<br\/><br\/>namespace ArunDepartmentalStore.Controllers<br\/>{<br\/>    public class tbl_productsController : Controller<br\/>    {<br\/>        string constr = &quot;Data Source=.\\\\sqlexpress;Initial Catalog=mvc;Integrated Security =true&quot;;<br\/><br\/>        \/\/ GET: tbl_products<br\/>        public ActionResult Index()<br\/>        {<br\/>            List<tbl_products> tbl_products_obj = new List<tbl_products>();<br\/>            SqlConnection con = new SqlConnection(constr);<br\/>            SqlCommand cmd = new SqlCommand(&quot;get_products&quot;, con);<br\/>            cmd.CommandType = System.Data.CommandType.StoredProcedure;<br\/>            con.Open();<br\/>            SqlDataReader sdr = cmd.ExecuteReader();<br\/>            while(sdr.Read())<br\/>            {<br\/>                tbl_products_obj.Add(new tbl_products<br\/>                {<br\/>                    id =  Convert.ToInt32( sdr[&quot;id&quot;]),<br\/>                    product_name = Convert.ToString(sdr[&quot;product_name&quot;]),<br\/>                    quantity = Convert.ToInt32(sdr[&quot;quantity&quot;])<br\/><br\/>                }<br\/>                    ); <br\/>            }<br\/>            con.Close();<br\/>             return View(tbl_products_obj);<br\/>        }<br\/><br\/>        \/\/ GET: tbl_products\/Details\/5<br\/>        public ActionResult Details(int id,tbl_products tbl_products_obj)<br\/>        {<br\/>            SqlConnection con = new SqlConnection(constr);<br\/>            string query = &quot;get_products_id &quot; + id;<br\/>            SqlCommand cmd = new SqlCommand(query, con);<br\/><br\/>            con.Open();<br\/>            SqlDataReader sdr = cmd.ExecuteReader();<br\/>            while (sdr.Read())<br\/>            {<br\/>                tbl_products_obj = new tbl_products<br\/>                {<br\/>                    id = Convert.ToInt32(sdr[&quot;id&quot;]),<br\/>                    product_name = Convert.ToString(sdr[&quot;product_name&quot;]),<br\/>                    quantity = Convert.ToInt32(sdr[&quot;quantity&quot;])<br\/><br\/>                };<br\/>            }<br\/>            con.Close();<br\/>            return View(tbl_products_obj);<br\/>        }<br\/><br\/>        \/\/ GET: tbl_products\/Create<br\/>        public ActionResult Create()<br\/>        {<br\/>            return View();<br\/>        }<br\/><br\/>        \/\/ POST: tbl_products\/Create<br\/>        [HttpPost]<br\/>        public ActionResult Create(tbl_products tbl_productobj)<br\/>        {<br\/>            try<br\/>            {<br\/>                SqlConnection con = new SqlConnection(constr);<br\/>                string query = &quot;insert_products &#039;&quot; + tbl_productobj.product_name + &quot;&#039;,&quot; + tbl_productobj.quantity;<br\/>                SqlCommand cmd = new SqlCommand(query, con);                <br\/>                con.Open();<br\/>                int i = cmd.ExecuteNonQuery();<br\/>                con.Close();  <br\/>                return RedirectToAction(&quot;Index&quot;);<br\/>            }<br\/>            catch<br\/>            {<br\/>                return View();<br\/>            }<br\/>        }<br\/><br\/>        \/\/ GET: tbl_products\/Edit\/5<br\/>        public ActionResult Edit(int id)<br\/>        {<br\/>            return View();<br\/>        }<br\/><br\/>        \/\/ POST: tbl_products\/Edit\/5<br\/>        [HttpPost]<br\/>        public ActionResult Edit(int id, tbl_products tbl_productobj)<br\/>        {<br\/>            try<br\/>            {<br\/>                SqlConnection con = new SqlConnection(constr);<br\/>                string query = &quot;edit_products &quot; + id +&quot;,&#039;&quot; + tbl_productobj.product_name + &quot;&#039;,&quot; + tbl_productobj.quantity;<br\/>                SqlCommand cmd = new SqlCommand(query, con);<br\/>                con.Open();<br\/>                int i = cmd.ExecuteNonQuery();<br\/>                con.Close();<br\/>                return RedirectToAction(&quot;Index&quot;);                 <br\/>            }<br\/>            catch<br\/>            {<br\/>                return View();<br\/>            }<br\/>        }<br\/><br\/>        \/\/ GET: tbl_products\/Delete\/5<br\/>        public ActionResult Delete(int id,tbl_products tbl_products_obj)<br\/>        {<br\/>            SqlConnection con = new SqlConnection(constr);<br\/>            string query = &quot;get_products_id &quot; + id;<br\/>            SqlCommand cmd = new SqlCommand(query, con);<br\/>      <br\/>            con.Open();<br\/>            SqlDataReader sdr = cmd.ExecuteReader();<br\/>            while (sdr.Read())<br\/>            {<br\/>                tbl_products_obj = new tbl_products <br\/>                {<br\/>                    id = Convert.ToInt32(sdr[&quot;id&quot;]),<br\/>                    product_name = Convert.ToString(sdr[&quot;product_name&quot;]),<br\/>                    quantity = Convert.ToInt32(sdr[&quot;quantity&quot;])<br\/><br\/>                } ;<br\/>            }<br\/>            con.Close();<br\/>            return View(tbl_products_obj);<br\/>             <br\/>        }<br\/><br\/>        \/\/ POST: tbl_products\/Delete\/5<br\/>        [HttpPost]<br\/>        public ActionResult Delete(int id)<br\/>        {<br\/>            try<br\/>            {<br\/>                SqlConnection con = new SqlConnection(constr);<br\/>                string query = &quot;delete_products &quot; + id ;<br\/>                SqlCommand cmd = new SqlCommand(query, con);<br\/>                con.Open();<br\/>                int i = cmd.ExecuteNonQuery();<br\/>                con.Close();<br\/>                return RedirectToAction(&quot;Index&quot;);<br\/> <br\/>            }<br\/>            catch<br\/>            {<br\/>                return View();<br\/>            }<br\/>        }<br\/>    }<br\/>}<\/code><\/pre> <\/div>\n<h2 id=\"view-code\">View Code<\/h2>\n<h4 id=\"index-cshtml\">Index.cshtml<\/h4>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Index.cshtml<\/span> <\/div> <pre class=\"language-cpp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-cpp code-embed-code\">@model IEnumerable<ArunDepartmentalStore.Models.tbl_products><br\/><br\/>@{<br\/>    ViewBag.Title = &quot;Index&quot;;<br\/>}<br\/><br\/><h2>Index<\/h2><br\/><br\/><p><br\/>    @Html.ActionLink(&quot;Create New&quot;, &quot;Create&quot;)<br\/><\/p><br\/><table class=&quot;table&quot;><br\/>    <tr><br\/>        <th><br\/>            @Html.DisplayNameFor(model => model.product_name)<br\/>        <\/th><br\/>        <th><br\/>            @Html.DisplayNameFor(model => model.quantity)<br\/>        <\/th><br\/>        <th><\/th><br\/>    <\/tr><br\/><br\/>@foreach (var item in Model) {<br\/>    <tr><br\/>        <td><br\/>            @Html.DisplayFor(modelItem => item.product_name)<br\/>        <\/td><br\/>        <td><br\/>            @Html.DisplayFor(modelItem => item.quantity)<br\/>        <\/td><br\/>        <td><br\/>            @Html.ActionLink(&quot;Edit&quot;, &quot;Edit&quot;, new { id=item.id }) |<br\/>            @Html.ActionLink(&quot;Details&quot;, &quot;Details&quot;, new { id=item.id }) |<br\/>            @Html.ActionLink(&quot;Delete&quot;, &quot;Delete&quot;, new { id=item.id })<br\/>        <\/td><br\/>    <\/tr><br\/>}<br\/><br\/><\/table><\/code><\/pre> <\/div>\n<h4 id=\"create-cshtml\">create.cshtml<\/h4>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">create.cshtml<\/span> <\/div> <pre class=\"language-cpp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-cpp code-embed-code\">@model ArunDepartmentalStore.Models.tbl_products<br\/><br\/>@{<br\/>    ViewBag.Title = &quot;Create&quot;;<br\/>}<br\/><br\/><h2>Create<\/h2><br\/><br\/><br\/>@using (Html.BeginForm()) <br\/>{<br\/>    @Html.AntiForgeryToken()<br\/>    <br\/>    <div class=&quot;form-horizontal&quot;><br\/>        <h4>tbl_products<\/h4><br\/>        <hr \/><br\/>        @Html.ValidationSummary(true, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>        <div class=&quot;form-group&quot;><br\/>            @Html.LabelFor(model => model.product_name, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            <div class=&quot;col-md-10&quot;><br\/>                @Html.EditorFor(model => model.product_name, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model => model.product_name, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            <\/div><br\/>        <\/div><br\/><br\/>        <div class=&quot;form-group&quot;><br\/>            @Html.LabelFor(model => model.quantity, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            <div class=&quot;col-md-10&quot;><br\/>                @Html.EditorFor(model => model.quantity, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model => model.quantity, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            <\/div><br\/>        <\/div><br\/><br\/>        <div class=&quot;form-group&quot;><br\/>            <div class=&quot;col-md-offset-2 col-md-10&quot;><br\/>                <input type=&quot;submit&quot; value=&quot;Create&quot; class=&quot;btn btn-default&quot; \/><br\/>            <\/div><br\/>        <\/div><br\/>    <\/div><br\/>}<br\/><br\/><div><br\/>    @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/><\/div><br\/><br\/>@section Scripts {<br\/>    @Scripts.Render(&quot;~\/bundles\/jqueryval&quot;)<br\/>}<\/code><\/pre> <\/div>\n<h4 id=\"edit-cshtml\">edit.cshtml<\/h4>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">edit.cshtml<\/span> <\/div> <pre class=\"language-cpp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-cpp code-embed-code\">@model ArunDepartmentalStore.Models.tbl_products<br\/><br\/>@{<br\/>    ViewBag.Title = &quot;Edit&quot;;<br\/>}<br\/><br\/><h2>Edit<\/h2><br\/><br\/><br\/>@using (Html.BeginForm())<br\/>{<br\/>    @Html.AntiForgeryToken()<br\/>    <br\/>    <div class=&quot;form-horizontal&quot;><br\/>        <h4>tbl_products<\/h4><br\/>        <hr \/><br\/>        @Html.ValidationSummary(true, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>        @Html.HiddenFor(model => model.id)<br\/><br\/>        <div class=&quot;form-group&quot;><br\/>            @Html.LabelFor(model => model.product_name, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            <div class=&quot;col-md-10&quot;><br\/>                @Html.EditorFor(model => model.product_name, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model => model.product_name, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            <\/div><br\/>        <\/div><br\/><br\/>        <div class=&quot;form-group&quot;><br\/>            @Html.LabelFor(model => model.quantity, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            <div class=&quot;col-md-10&quot;><br\/>                @Html.EditorFor(model => model.quantity, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model => model.quantity, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            <\/div><br\/>        <\/div><br\/><br\/>        <div class=&quot;form-group&quot;><br\/>            <div class=&quot;col-md-offset-2 col-md-10&quot;><br\/>                <input type=&quot;submit&quot; value=&quot;Save&quot; class=&quot;btn btn-default&quot; \/><br\/>            <\/div><br\/>        <\/div><br\/>    <\/div><br\/>}<br\/><br\/><div><br\/>    @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/><\/div><br\/><br\/>@section Scripts {<br\/>    @Scripts.Render(&quot;~\/bundles\/jqueryval&quot;)<br\/>}<\/code><\/pre> <\/div>\n<h4 id=\"details-cshtml\">Details.cshtml<\/h4>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Details.cshtml<\/span> <\/div> <pre class=\"language-cpp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-cpp code-embed-code\">@model ArunDepartmentalStore.Models.tbl_products<br\/><br\/>@{<br\/>    ViewBag.Title = &quot;Details&quot;;<br\/>}<br\/><br\/><h2>Details<\/h2><br\/><br\/><div><br\/>    <h4>tbl_products<\/h4><br\/>    <hr \/><br\/>    <dl class=&quot;dl-horizontal&quot;><br\/>        <dt><br\/>            @Html.DisplayNameFor(model => model.product_name)<br\/>        <\/dt><br\/><br\/>        <dd><br\/>            @Html.DisplayFor(model => model.product_name)<br\/>        <\/dd><br\/><br\/>        <dt><br\/>            @Html.DisplayNameFor(model => model.quantity)<br\/>        <\/dt><br\/><br\/>        <dd><br\/>            @Html.DisplayFor(model => model.quantity)<br\/>        <\/dd><br\/><br\/>    <\/dl><br\/><\/div><br\/><p><br\/>    @Html.ActionLink(&quot;Edit&quot;, &quot;Edit&quot;, new { id = Model.id }) |<br\/>    @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/><\/p><\/code><\/pre> <\/div>\n<h4 id=\"delete-cshtml\">Delete.cshtml<\/h4>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Delete.cshtml<\/span> <\/div> <pre class=\"language-markup code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markup code-embed-code\">@model ArunDepartmentalStore.Models.tbl_products<br\/><br\/>@{<br\/>    ViewBag.Title = &quot;Delete&quot;;<br\/>}<br\/><br\/><h2>Delete<\/h2><br\/><br\/><h3>Are you sure you want to delete this?<\/h3><br\/><div><br\/>    <h4>tbl_products<\/h4><br\/>    <hr \/><br\/>    <dl class=&quot;dl-horizontal&quot;><br\/>        <dt><br\/>            @Html.DisplayNameFor(model => model.product_name)<br\/>        <\/dt><br\/><br\/>        <dd><br\/>            @Html.DisplayFor(model => model.product_name)<br\/>        <\/dd><br\/><br\/>        <dt><br\/>            @Html.DisplayNameFor(model => model.quantity)<br\/>        <\/dt><br\/><br\/>        <dd><br\/>            @Html.DisplayFor(model => model.quantity)<br\/>        <\/dd><br\/><br\/>    <\/dl><br\/><br\/>    @using (Html.BeginForm()) {<br\/>        @Html.AntiForgeryToken()<br\/><br\/>        <div class=&quot;form-actions no-color&quot;><br\/>            <input type=&quot;submit&quot; value=&quot;Delete&quot; class=&quot;btn btn-default&quot; \/> |<br\/>            @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/>        <\/div><br\/>    }<br\/><\/div><\/code><\/pre> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Database code Model Code Controller Code View Code Index.cshtml create.cshtml edit.cshtml Details.cshtml Delete.cshtml<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19084],"tags":[19089,19090,19086,19088,19085,19087],"class_list":["post-5073","post","type-post","status-publish","format-standard","hentry","category-csharp","tag-net","tag-net-mvc","tag-asp-mvc","tag-charp-mvc","tag-mvc","tag-mvc-code"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MVC Code - Wikitechy<\/title>\n<meta name=\"description\" content=\"MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected, testable and easy to maintain.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MVC Code - Wikitechy\" \/>\n<meta property=\"og:description\" content=\"MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected, testable and easy to maintain.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-27T02:49:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-24T11:41:25+00:00\" \/>\n<meta name=\"author\" content=\"webmaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webmaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/\"},\"author\":{\"name\":\"webmaster\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"headline\":\"MVC Code\",\"datePublished\":\"2022-12-27T02:49:22+00:00\",\"dateModified\":\"2023-06-24T11:41:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/\"},\"wordCount\":2217,\"commentCount\":0,\"keywords\":[\".net\",\".net mvc\",\"asp mvc\",\"charp mvc\",\"mvc\",\"mvc code\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/\",\"name\":\"MVC Code - Wikitechy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"datePublished\":\"2022-12-27T02:49:22+00:00\",\"dateModified\":\"2023-06-24T11:41:25+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected, testable and easy to maintain.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/csharp\\\/mvc-code\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/f785ba3ecc599133e65ab6138042a3e4\",\"name\":\"webmaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"caption\":\"webmaster\"},\"sameAs\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\"],\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/webmaster\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MVC Code - Wikitechy","description":"MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected, testable and easy to maintain.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/","og_locale":"en_US","og_type":"article","og_title":"MVC Code - Wikitechy","og_description":"MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected, testable and easy to maintain.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/","og_site_name":"Wikitechy","article_published_time":"2022-12-27T02:49:22+00:00","article_modified_time":"2023-06-24T11:41:25+00:00","author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/"},"author":{"name":"webmaster","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"headline":"MVC Code","datePublished":"2022-12-27T02:49:22+00:00","dateModified":"2023-06-24T11:41:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/"},"wordCount":2217,"commentCount":0,"keywords":[".net",".net mvc","asp mvc","charp mvc","mvc","mvc code"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/","name":"MVC Code - Wikitechy","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2022-12-27T02:49:22+00:00","dateModified":"2023-06-24T11:41:25+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected, testable and easy to maintain.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/csharp\/mvc-code\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4","name":"webmaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","caption":"webmaster"},"sameAs":["https:\/\/www.wikitechy.com\/interview-questions"],"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/5073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=5073"}],"version-history":[{"count":5,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/5073\/revisions"}],"predecessor-version":[{"id":5078,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/5073\/revisions\/5078"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=5073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=5073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=5073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}