<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"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&lt;tbl_products&gt; tbl_products_obj = new List&lt;tbl_products&gt;();<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&lt;ArunDepartmentalStore.Models.tbl_products&gt;<br\/><br\/>@{<br\/>    ViewBag.Title = &quot;Index&quot;;<br\/>}<br\/><br\/>&lt;h2&gt;Index&lt;\/h2&gt;<br\/><br\/>&lt;p&gt;<br\/>    @Html.ActionLink(&quot;Create New&quot;, &quot;Create&quot;)<br\/>&lt;\/p&gt;<br\/>&lt;table class=&quot;table&quot;&gt;<br\/>    &lt;tr&gt;<br\/>        &lt;th&gt;<br\/>            @Html.DisplayNameFor(model =&gt; model.product_name)<br\/>        &lt;\/th&gt;<br\/>        &lt;th&gt;<br\/>            @Html.DisplayNameFor(model =&gt; model.quantity)<br\/>        &lt;\/th&gt;<br\/>        &lt;th&gt;&lt;\/th&gt;<br\/>    &lt;\/tr&gt;<br\/><br\/>@foreach (var item in Model) {<br\/>    &lt;tr&gt;<br\/>        &lt;td&gt;<br\/>            @Html.DisplayFor(modelItem =&gt; item.product_name)<br\/>        &lt;\/td&gt;<br\/>        &lt;td&gt;<br\/>            @Html.DisplayFor(modelItem =&gt; item.quantity)<br\/>        &lt;\/td&gt;<br\/>        &lt;td&gt;<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\/>        &lt;\/td&gt;<br\/>    &lt;\/tr&gt;<br\/>}<br\/><br\/>&lt;\/table&gt;<\/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\/>&lt;h2&gt;Create&lt;\/h2&gt;<br\/><br\/><br\/>@using (Html.BeginForm()) <br\/>{<br\/>    @Html.AntiForgeryToken()<br\/>    <br\/>    &lt;div class=&quot;form-horizontal&quot;&gt;<br\/>        &lt;h4&gt;tbl_products&lt;\/h4&gt;<br\/>        &lt;hr \/&gt;<br\/>        @Html.ValidationSummary(true, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>        &lt;div class=&quot;form-group&quot;&gt;<br\/>            @Html.LabelFor(model =&gt; model.product_name, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            &lt;div class=&quot;col-md-10&quot;&gt;<br\/>                @Html.EditorFor(model =&gt; model.product_name, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model =&gt; model.product_name, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            &lt;\/div&gt;<br\/>        &lt;\/div&gt;<br\/><br\/>        &lt;div class=&quot;form-group&quot;&gt;<br\/>            @Html.LabelFor(model =&gt; model.quantity, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            &lt;div class=&quot;col-md-10&quot;&gt;<br\/>                @Html.EditorFor(model =&gt; model.quantity, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model =&gt; model.quantity, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            &lt;\/div&gt;<br\/>        &lt;\/div&gt;<br\/><br\/>        &lt;div class=&quot;form-group&quot;&gt;<br\/>            &lt;div class=&quot;col-md-offset-2 col-md-10&quot;&gt;<br\/>                &lt;input type=&quot;submit&quot; value=&quot;Create&quot; class=&quot;btn btn-default&quot; \/&gt;<br\/>            &lt;\/div&gt;<br\/>        &lt;\/div&gt;<br\/>    &lt;\/div&gt;<br\/>}<br\/><br\/>&lt;div&gt;<br\/>    @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/>&lt;\/div&gt;<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\/>&lt;h2&gt;Edit&lt;\/h2&gt;<br\/><br\/><br\/>@using (Html.BeginForm())<br\/>{<br\/>    @Html.AntiForgeryToken()<br\/>    <br\/>    &lt;div class=&quot;form-horizontal&quot;&gt;<br\/>        &lt;h4&gt;tbl_products&lt;\/h4&gt;<br\/>        &lt;hr \/&gt;<br\/>        @Html.ValidationSummary(true, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>        @Html.HiddenFor(model =&gt; model.id)<br\/><br\/>        &lt;div class=&quot;form-group&quot;&gt;<br\/>            @Html.LabelFor(model =&gt; model.product_name, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            &lt;div class=&quot;col-md-10&quot;&gt;<br\/>                @Html.EditorFor(model =&gt; model.product_name, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model =&gt; model.product_name, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            &lt;\/div&gt;<br\/>        &lt;\/div&gt;<br\/><br\/>        &lt;div class=&quot;form-group&quot;&gt;<br\/>            @Html.LabelFor(model =&gt; model.quantity, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })<br\/>            &lt;div class=&quot;col-md-10&quot;&gt;<br\/>                @Html.EditorFor(model =&gt; model.quantity, new { htmlAttributes = new { @class = &quot;form-control&quot; } })<br\/>                @Html.ValidationMessageFor(model =&gt; model.quantity, &quot;&quot;, new { @class = &quot;text-danger&quot; })<br\/>            &lt;\/div&gt;<br\/>        &lt;\/div&gt;<br\/><br\/>        &lt;div class=&quot;form-group&quot;&gt;<br\/>            &lt;div class=&quot;col-md-offset-2 col-md-10&quot;&gt;<br\/>                &lt;input type=&quot;submit&quot; value=&quot;Save&quot; class=&quot;btn btn-default&quot; \/&gt;<br\/>            &lt;\/div&gt;<br\/>        &lt;\/div&gt;<br\/>    &lt;\/div&gt;<br\/>}<br\/><br\/>&lt;div&gt;<br\/>    @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/>&lt;\/div&gt;<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\/>&lt;h2&gt;Details&lt;\/h2&gt;<br\/><br\/>&lt;div&gt;<br\/>    &lt;h4&gt;tbl_products&lt;\/h4&gt;<br\/>    &lt;hr \/&gt;<br\/>    &lt;dl class=&quot;dl-horizontal&quot;&gt;<br\/>        &lt;dt&gt;<br\/>            @Html.DisplayNameFor(model =&gt; model.product_name)<br\/>        &lt;\/dt&gt;<br\/><br\/>        &lt;dd&gt;<br\/>            @Html.DisplayFor(model =&gt; model.product_name)<br\/>        &lt;\/dd&gt;<br\/><br\/>        &lt;dt&gt;<br\/>            @Html.DisplayNameFor(model =&gt; model.quantity)<br\/>        &lt;\/dt&gt;<br\/><br\/>        &lt;dd&gt;<br\/>            @Html.DisplayFor(model =&gt; model.quantity)<br\/>        &lt;\/dd&gt;<br\/><br\/>    &lt;\/dl&gt;<br\/>&lt;\/div&gt;<br\/>&lt;p&gt;<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\/>&lt;\/p&gt;<\/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\/>&lt;h2&gt;Delete&lt;\/h2&gt;<br\/><br\/>&lt;h3&gt;Are you sure you want to delete this?&lt;\/h3&gt;<br\/>&lt;div&gt;<br\/>    &lt;h4&gt;tbl_products&lt;\/h4&gt;<br\/>    &lt;hr \/&gt;<br\/>    &lt;dl class=&quot;dl-horizontal&quot;&gt;<br\/>        &lt;dt&gt;<br\/>            @Html.DisplayNameFor(model =&gt; model.product_name)<br\/>        &lt;\/dt&gt;<br\/><br\/>        &lt;dd&gt;<br\/>            @Html.DisplayFor(model =&gt; model.product_name)<br\/>        &lt;\/dd&gt;<br\/><br\/>        &lt;dt&gt;<br\/>            @Html.DisplayNameFor(model =&gt; model.quantity)<br\/>        &lt;\/dt&gt;<br\/><br\/>        &lt;dd&gt;<br\/>            @Html.DisplayFor(model =&gt; model.quantity)<br\/>        &lt;\/dd&gt;<br\/><br\/>    &lt;\/dl&gt;<br\/><br\/>    @using (Html.BeginForm()) {<br\/>        @Html.AntiForgeryToken()<br\/><br\/>        &lt;div class=&quot;form-actions no-color&quot;&gt;<br\/>            &lt;input type=&quot;submit&quot; value=&quot;Delete&quot; class=&quot;btn btn-default&quot; \/&gt; |<br\/>            @Html.ActionLink(&quot;Back to List&quot;, &quot;Index&quot;)<br\/>        &lt;\/div&gt;<br\/>    }<br\/>&lt;\/div&gt;<\/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":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"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 v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\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\":\"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\":\"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"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":"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":"required name=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:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","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}]}}