Manual CRUD Operation In MVC Using ADO.NET

I am explaining about manual CRUD operations;  i.e., I am not using entity framework here. I am using  ADO.NET. So we will see step by step.

Step 1

First, we have to create a database. Here I took an example of database ‘MVCDB’ and created a table for this; I took the example table name ‘Registration’.

For this open the SQL Server management studio to create these.

open

Step 2

Now we have to create a project, so for this open visual studio and create a project and give a name for example, CRUDOperation,

create

Next we click OK button and choose mvc template and again click OK.

mvc

After creating the project we have to create a model class so for this, I added a model class and gave a name, for example, User.cs. In this go in solution explorer and go to the model folder and select Add option and select a class,

class

Write the code and define all properties of user class

User.cs

  1. using System.Web;  
  2.   
  3. namespace mvcRegistration.Models  
  4.   
  5. {  
  6.     public class User  
  7.   
  8.     {  
  9.         public int userId  
  10.       {  
  11.             get;  
  12.             set;  
  13.         }  
  14.   
  15.         public string firstName   
  16.         {  
  17.             get;  
  18.             set  
  19.         }  
  20.   
  21.         public string middileName   
  22.         {  
  23.             get;  
  24.             set;  
  25.         }  
  26.   
  27.         public string lastName   
  28.         {  
  29.             get;  
  30.             set;  
  31.         }  
  32.   
  33.         public string dob   
  34.         {  
  35.             get;  
  36.             set;  
  37.         }  
  38.   
  39.         public string address   
  40.         {  
  41.             get;  
  42.             set;  
  43.         }  
  44.   
  45.         public string phoneNo   
  46.         {  
  47.             get;  
  48.             set;  
  49.         }  
  50.   
  51.         public string emailId  
  52.         {  
  53.             get;  
  54.             set;  
  55.         }  
  56.   
  57.         public string password   
  58.         {  
  59.             get;  
  60.             set;  
  61.         }  
  62.   
  63.         public string pincode  
  64.         {  
  65.             get;  
  66.             set;  
  67.         }  
  68.   
  69.     }  
  70.   
  71. }  
Again add another class(same process) and give the a name(Ex: Details.cs).Here I created a class and wrote business logic to display the user information.

Add the namespace Data and Data.SqlClient for database operation.

Details.cs
  1. using System;  
  2.   
  3. using System.Data;  
  4.   
  5. using System.Data.SqlClient;  
  6.   
  7. namespace mvcRegistration.Models  
  8.   
  9. {  
  10.     public class Details  
  11.   
  12.     {  
  13.         string constr = @ "Server=mithilesh;Database=MVCDB;User Id=sa;Password=password";  
  14.   
  15.         public void AddUser(User obj)  
  16.   
  17.         {  
  18.   
  19.             string cmdText = string.Format("Insert into Registration vaules{0},{1},{2},{3},{4},{5},{6},{7},{8},{9})", obj.userId, obj.firstName, obj.middileName, obj.lastName, obj.dob, obj.address, obj.phoneNo, obj.emailId, obj.password, obj.pincode);  
  20.   
  21.             SqlConnection con = new SqlConnection(constr);  
  22.   
  23.             SqlCommand cmd = new SqlCommand(cmdText, con);  
  24.   
  25.             con.Open();  
  26.   
  27.             cmd.ExecuteNonQuery();  
  28.   
  29.             con.Close();  
  30.   
  31.         }  
  32.         public void DeleteUser(int i)  
  33.   
  34.         {  
  35.             string cmdText = string.Format("Delete from Registration where UserId={0}", i);  
  36.   
  37.             SqlConnection con = new SqlConnection(constr);  
  38.   
  39.             SqlCommand cmd = new SqlCommand(cmdText, con);  
  40.   
  41.             con.Open();  
  42.   
  43.             cmd.ExecuteNonQuery();  
  44.   
  45.             con.Close();  
  46.   
  47.         }  
  48.         public void EditUser(User obj)  
  49.   
  50.         {  
  51.             string cmdText = string.Format("Update Registration Set FirstName='{0}',MidleName='{1}',LastName='{2}',DOB='{3}',Addres='{4}',FoneNo='{5}',EmailId='{6}',Password='{7}',PinCode='{8}' where UserId={9}",  
  52.                 obj.firstName, obj.middileName, obj.lastName, obj.dob, obj.address, obj.phoneNo, obj.emailId, obj.password, obj.pincode, obj.userId);  
  53.   
  54.   
  55.             SqlConnection con = new SqlConnection(constr);  
  56.   
  57.             SqlCommand cmd = new SqlCommand(cmdText, con);  
  58.   
  59.             con.Open();  
  60.   
  61.             cmd.ExecuteNonQuery();  
  62.   
  63.             con.Close();  
  64.   
  65.         }  
  66.   
  67.     }  
  68.   
Again we add a class (with same process)

And give a name(Ex: DataContext.cs).

See the below
  1. using System;  
  2. using System.Web;  
  3. using System.Data;  
  4. using System.Data.SqlClient;  
  5.   
  6. namespace mvcRegistration.Models  
  7.   
  8. {  
  9.     public class DataContext  
  10.   
  11.     {  
  12.         string constr = @ "Server=mithilesh;Database=MVCDB;User Id=sa;Password=password";  
  13.   
  14.         public List < User > GetUsers()  
  15.   
  16.         {  
  17.             string cmdText = "Select * from Registration";  
  18.   
  19.             SqlDataAdapter da = new SqlDataAdapter(cmdText, constr);  
  20.   
  21.             DataSet ds = new DataSet();  
  22.   
  23.             da.Fill(ds);  
  24.             List < User > UserList = new List < User > ();  
  25.   
  26.             foreach(DataRow item in ds.Tables[0].Rows)  
  27.   
  28.             {  
  29.                 User objUser = new User();  
  30.   
  31.                 objUser.userId = int.Parse(item["UserId"].ToString());  
  32.   
  33.                 objUser.firstName = item["FirstName"].ToString();  
  34.   
  35.                 objUser.middileName = item["MidleName"].ToString();  
  36.   
  37.                 objUser.lastName = item["LastName"].ToString();  
  38.   
  39.                 objUser.dob = item["DOB"].ToString();  
  40.   
  41.                 objUser.address = item["Addres"].ToString();  
  42.   
  43.                 objUser.phoneNo = item["FoneNo"].ToString();  
  44.   
  45.                 objUser.emailId = item["EmailId"].ToString();  
  46.   
  47.                 objUser.password = item["Password"].ToString();  
  48.   
  49.                 objUser.pincode = item["PinCode"].ToString();  
  50.   
  51.                 UserList.Add(objUser);  
  52.   
  53.             }  
  54.             return UserList;  
  55.   
  56.         }  
  57.         public User GetUser(int i)  
  58.   
  59.         {  
  60.             string cmdText = "Select * from Registration Where UserId=" + i;  
  61.   
  62.             SqlConnection con = new SqlConnection(constr);  
  63.   
  64.             SqlCommand cmd = new SqlCommand(cmdText, con);  
  65.   
  66.             con.Open();  
  67.             SqlDataReader dr = cmd.ExecuteReader();  
  68.   
  69.             User objUser = new User();  
  70.   
  71.             if (dr.Read() == true)  
  72.   
  73.             {  
  74.                 objUser.userId = int.Parse(dr["UserIs"].ToString());  
  75.   
  76.                 objUser.firstName = dr["FirstName"].ToString();  
  77.   
  78.                 objUser.middileName = dr["MidleName"].ToString();  
  79.   
  80.                 objUser.lastName = dr["LastName"].ToString();  
  81.   
  82.                 objUser.dob = dr["DOB"].ToString();  
  83.   
  84.                 objUser.address = dr["Addres"].ToString();  
  85.   
  86.                 objUser.phoneNo = dr["FoneNo"].ToString();  
  87.   
  88.                 objUser.emailId = dr["EmailId"].ToString();  
  89.   
  90.                 objUser.password = dr["Password"].ToString();  
  91.   
  92.                 objUser.pincode = dr["PinCode"].ToString();  
  93.   
  94.             }  
  95.             con.Close();  
  96.             return objUser;  
  97.   
  98.         }  
  99.   
  100.     }  
  101.   
  102. }  
Step 3

Now we have to create a controller class so for this, right click on solution explorer and go to Controllers folder and right click on the controller and add a controller class and give a name, for example RegController.

I selected empty Controller and clicked add option,

Controller

Note: Here we have to add a namespace.

(According my project)

using mvcRegistration.Models;

And write the code as shown below,
  1. using System;  
  2. using System.Web;  
  3. using System.Web.Mvc;  
  4. using mvcRegistration.Models;  
  5.   
  6. namespace mvcRegistration.Controllers  
  7.   
  8. {  
  9.     public class RegController: Controller  
  10.   
  11.     { //  
  12.   
  13.         // GET: /Reg/  
  14.   
  15.         Details ds = new Details();  
  16.   
  17.         DataContext DC = new DataContext();  
  18.   
  19.         public ActionResult Index()  
  20.   
  21.         {  
  22.             List < User > UserList = DC.GetUsers();  
  23.   
  24.             return View(UserList);  
  25.   
  26.         }  
  27.         public ActionResult Details(int id)  
  28.   
  29.         {  
  30.             User objUser = DC.GetUser(id);  
  31.   
  32.             return View(objUser);  
  33.   
  34.         }  
  35.         public ActionResult Create()  
  36.   
  37.         {  
  38.             return View();  
  39.   
  40.         }  
  41.         [HttpPost]  
  42.   
  43.         public ActionResult Create(User obj)  
  44.   
  45.         {  
  46.             ds.AddUser(obj);  
  47.             return RedirectToAction("Index");  
  48.   
  49.         }  
  50.         public ActionResult Delete(int id)  
  51.   
  52.         {  
  53.             User obj = DC.GetUser(id);  
  54.   
  55.             return View(obj);  
  56.   
  57.         }  
  58.         [HttpPost]  
  59.   
  60.         public ActionResult Delete(string id)  
  61.   
  62.         {  
  63.             int i = int.Parse(id);  
  64.   
  65.             ds.DeleteUser(i);  
  66.             return RedirectToAction("Index");  
  67.   
  68.         }  
  69.         public ActionResult Edit(int id)  
  70.   
  71.         {  
  72.             User obj = DC.GetUser(id);  
  73.   
  74.             return View(obj);  
  75.   
  76.         }  
  77.         public ActionResult Edit(User obj)  
  78.   
  79.         {  
  80.             ds.EditUser(obj);  
  81.             return RedirectToAction("Index");  
  82.   
  83.   
  84.         }  
  85.   
  86.     }  
  87.   
  88. }  
Step 4

Now we have to create, view pages for displaying the user information so for this, Right click on index() method in RegController.

Select AddView, here it automaticaly displays the index name so leave that and click ok, then one view page is created, "Index.cshtml".

And then write the code,

NOTE-Add namespace   
  1. @using mvcRegistration.Models  
  2. @model IEnumerable  
  3. <User>  
  4.   
  5. index.cshtml  
  6. @{  
  7. ViewBag.Title = "Index";  
  8.   
  9. }  
  10.   
  11. @using mvcRegistration.Models  
  12.   
  13. @model IEnumerable  
  14.     <User>  
  15.         <div align="center">  
  16.             <h1 align="center" style="background-color: aqua; color: maroon;border-radius: 25px; box-shadow: 10px 10px 10px 10px yellow; width:800px;">Index</h1>  
  17.         </div>  
  18.         <hr />  
  19.         <div align="center">  
  20.             <a href="Home/Create">  
  21.                 <b style="font-size: 25px"align="center">Create New</b>  
  22.             </a>  
  23.         </div>  
  24.         <br />  
  25.         <br />  
  26.         <table align="center" width="80%" style="background-image:url(Images/Baroque-485x728.jpg); background-color: darkgreen;border: double solid maroon; font-weight: bold; color: white; padding:5px 8px 4px 10px; border-color: white; font-size: 20px; border-radius:25px; box-shadow: 10px 10px 10px 10px maroon" border="3">  
  27.             <tr>  
  28.                 <th width="10%">User Id</th>  
  29.                 <th>First Name</th>  
  30.                 <th>Middle Name</th>  
  31.                 <th>Last Name</th>  
  32.                 <th width="10%">DOB</th>  
  33.                 <th>Address</th>  
  34.                 <th>Phone Number</th>  
  35.                 <th>Emaild Id</th>  
  36.                 <th>Password</th>  
  37.                 <th>PinCode</th>  
  38.             </tr>  
  39.   
  40. @{  
  41. foreach (User item in Model)  
  42.   
  43. {  
  44. int n = item.userId;  
  45.   
  46.   
  47.             <tr>  
  48.                 <td>@item.userId</td>  
  49.                 <td>@item.firstName</td>  
  50.                 <td>@item.middileName</td>  
  51.                 <td>@item.lastName</td>  
  52.                 <td>@item.dob</td>  
  53.                 <td>@item.address</td>  
  54.                 <td>@item.phoneNo</td>  
  55.                 <td>@item.emailId</td>  
  56.                 <td>@item.password</td>  
  57.                 <td>@item.pincode</td>  
  58.             </tr>  
  59.   
  60. }  
  61. }  
  62.    
  63.         </table>  
See the output

output

Similarly, we have to add a class to display information for a particular user.

So for this, right click on detail method in the controller and add a view page and give a name for exam details.cshtml and write the code.

details.cshtml
  1. @{  
  2. Layout = null;  
  3.   
  4. }  
  5.   
  6. @using mvcRegistration.Models  
  7.   
  8. @model User  
  9.   
  10.   
  11. <!DOCTYPE html>  
  12. <html>  
  13.     <head>  
  14.         <meta name="viewport" content="width=device-width" />  
  15.         <title>Details</title>  
  16.     </head>  
  17.     <body>  
  18.         <div>  
  19.             <table width="40%" border="2" align="center" style="background-image:url(~/Images/colorful_ride-wide.jpg); background-color:#3D0B0B; border: double solid maroon; font-weight: bold; color:white; padding: 5px 8px 4px 10px; border-color: white; font-size:20px; border-radius: 25px; box-shadow: 10px 10px 10px 10pxmaroon; font-weight: bold">  
  20.                 <tr>  
  21.                     <td>User Id</td>  
  22.                     <td>@Model.userId</td>  
  23.                 </tr>  
  24.                 <tr>  
  25.                     <td>First Name</td>  
  26.                     <td>@Model.firstName</td>  
  27.                 </tr>  
  28.                 <tr>  
  29.                     <td>Middle Name</td>  
  30.                     <td>@Model.middileName</td>  
  31.                 </tr>  
  32.                 <tr>  
  33.                     <td>Last Name</td>  
  34.                     <td>@Model.lastName</td>  
  35.                 </tr>  
  36.                 <tr>  
  37.                     <td>Date of Birthday</td>  
  38.                     <td>@Model.dob</td>  
  39.                 </tr>  
  40.                 <tr>  
  41.                     <td>Addrss</td>  
  42.                     <td>@Model.address</td>  
  43.                 </tr>  
  44.                 <tr>  
  45.                     <td>Phone Number</td>  
  46.                     <td>@Model.phoneNo</td>  
  47.                 </tr>  
  48.                 <tr>  
  49.                     <td>Email Id</td>  
  50.                     <td>@Model.emailId</td>  
  51.                 </tr>  
  52.                 <tr>  
  53.                     <td>Password</td>  
  54.                     <td>@Model.password</td>  
  55.                 </tr>  
  56.                 <tr>  
  57.                     <td>PinCode</td>  
  58.                     <td>@Model.pincode</td>  
  59.                 </tr>  
  60.                 <tr>  
  61.                     <td colspan="2">  
  62.                         <a href="/">Back to Index</a>  
  63.                     </td>  
  64.                 </tr>  
  65.             </table>  
  66.         </div>  
  67.     </body>  
  68. </html>  
See the output

output

Similarly, we have to add a class to Add information for a particular user.

So for this, right click on create method in the controller and add a view page and give a name, for example, create.cshtml and write the code.

Create.cshtml
  1. @{  
  2. Layout = null;  
  3.   
  4. }  
  5.   
  6.   
  7. <!DOCTYPE html>  
  8. <html>  
  9.     <head>  
  10.         <meta name="viewport" content="width=device-width" />  
  11.         <title>Create</title>  
  12.     </head>  
  13.     <body>  
  14.         <div align="center">  
  15.             <h1 align="center" style="background-color:aqua; color: maroon; border-radius: 25px; box-shadow: 10px 10px10px 10px yellow; width: 800px;">Create New Employee Details</h1>  
  16.         </div>  
  17.         <div>  
  18.   
  19. @using(Html.BeginForm())  
  20.   
  21.   
  22. {  
  23.   
  24.             <table width="40%" border="2" align="center" style="background-image:url(~/Images/colorful_ride-wide.jpg); background-color:#061CC7; border: double solid maroon; font-weight: bold; color:white; padding: 5px 8px 4px 10px; border-color: white; font-size:20px; border-radius: 25px; box-shadow: 10px 10px 10px 10pxmaroon; font-weight: bold">  
  25.                 <tr>  
  26.                     <td>@Html.Label("First Name")</td>  
  27.                     <td>@Html.TextBox("FirstName")</td>  
  28.                 </tr>  
  29.                 <tr>  
  30.                     <td>@Html.Label("MiddleName")</td>  
  31.                     <td>@Html.TextBox("MiddleName")</td>  
  32.                 </tr>  
  33.                 <tr>  
  34.                     <td>@Html.Label("Last Name")</td>  
  35.                     <td>@Html.TextBox("LastName")</td>  
  36.                 </tr>  
  37.                 <tr>  
  38.                     <td>@Html.Label("Date Of Birth")</td>  
  39.                     <td>@Html.TextBox("DOB")</td>  
  40.                 </tr>  
  41.                 <tr>  
  42.                     <td>@Html.Label("Address")</td>  
  43.                     <td>@Html.TextBox("Addres")</td>  
  44.                 </tr>  
  45.                 <tr>  
  46.                     <td>@Html.Label("Phone Number")</td>  
  47.                     <td>@Html.TextBox("FoneNo")</td>  
  48.                 </tr>  
  49.                 <tr>  
  50.                     <td>@Html.Label("Email Id")</td>  
  51.                     <td>@Html.TextBox("EmailId")</td>  
  52.                 </tr>  
  53.                 <tr>  
  54.                     <td>@Html.Label("Password")</td>  
  55.                     <td>@Html.TextBox("Password")</td>  
  56.                 </tr>  
  57.                 <tr>  
  58.                     <td>@Html.Label("Pine Code")</td>  
  59.                     <td>@Html.TextBox("PinCode")</td>  
  60.                 </tr>  
  61.                 <tr>  
  62.                     <td colspan="2" align="center">  
  63.                         <input type="submit"name="sb1" value="Create" />  
  64.                     </td>  
  65.                 </tr>  
  66.             </table>  
  67.   
  68. }  
  69.   
  70.             <br />  
  71.             <a href="/" style="font-size:25px;align-content:center">  
  72.                 <balignbalign="center">Back to Index  
  73.                 </b>  
  74.             </a>  
  75.         </div>  
  76.     </body>  
  77. </html>  
See the output

output
Similarly, we have to add a class to delete information for a particular user.

So for this, right click on delete method in the controller and add a view page and give a name for exam delete.cshtml and write the code.

delete.cshtml
  1. @{  
  2. Layout = null;  
  3.   
  4. }  
  5.   
  6. @using mvcRegistration.Models;  
  7.   
  8. @model User  
  9.   
  10.   
  11. <!DOCTYPE html>  
  12. <html>  
  13.     <head>  
  14.         <meta name="viewport" content="width=device-width" />  
  15.         <title>Delete</title>  
  16.     </head>  
  17.     <body>  
  18.         <div>  
  19.             <div align="center">  
  20.                 <h1 align="center" style="background-color: aqua; color: maroon;border-radius: 15px; box-shadow: 7px 7px 7px 7px darkgreen; width:800px;">Delete Employee Detail</h1>  
  21.             </div>  
  22.             <br />  
  23.   
  24. @using (Html.BeginForm())  
  25.   
  26.   
  27.   
  28.   
  29. {  
  30.   
  31.             <table width="40%" border="2" align="center" style="background-image: url(~/Images/colorful_ride-wide.jpg); background-color:#3D0B0B; border: double solid maroon; font-weight: bold; color:white; padding: 5px 8px 4px 10px; border-color: white; font-size:20px; border-radius: 25px; box-shadow: 10px 10px 10px 10pxdarkgreen; font-weight: bold">  
  32.                 <tr>  
  33.                     <td>@Html.Label("User Id")</td>  
  34.                     <td>@Html.TextBox("UserId")</td>  
  35.                 </tr>  
  36.                 <tr>  
  37.                     <td>@Html.Label("First Name")</td>  
  38.                     <td>@Html.TextBox("FirstName")</td>  
  39.                 </tr>  
  40.                 <tr>  
  41.                     <td>@Html.Label("MiddleName")</td>  
  42.                     <td>@Html.TextBox("MidleName")</td>  
  43.                 </tr>  
  44.                 <tr>  
  45.                     <td>@Html.Label("Last Name")</td>  
  46.                     <td>@Html.TextBox("LastName")</td>  
  47.                 </tr>  
  48.                 <tr>  
  49.                     <td>@Html.Label("Date Of birth")</td>  
  50.                     <td>@Html.TextBox("DOB")</td>  
  51.                 </tr>  
  52.                 <tr>  
  53.                     <td>@Html.Label("Address")</td>  
  54.                     <td>@Html.TextBox("Addres")</td>  
  55.                 </tr>  
  56.                 <tr>  
  57.                     <td>@Html.Label("Phone Number")</td>  
  58.                     <td>@Html.TextBox("FoneNo")</td>  
  59.                 </tr>  
  60.                 <tr>  
  61.                     <td>@Html.Label("Email Id")</td>  
  62.                     <td>@Html.TextBox("EmailId")</td>  
  63.                 </tr>  
  64.                 <tr>  
  65.                     <td>@Html.Label("Password")</td>  
  66.                     <td>@Html.TextBox("Password")</td>  
  67.                 </tr>  
  68.                 <tr>  
  69.                     <td>@Html.Label("Pine Code")</td>  
  70.                     <td>@Html.TextBox("PinCode")</td>  
  71.                 </tr>  
  72.                 <tr>  
  73.                     <td colspan="2">  
  74.                         <b align="center" style="color: red; font-size:30px">Do want delete?</b>      
  75.   
  76.   
  77.                         <input type="submit" style="font-size: 25px; font-weight: bold"name="sb1" value="Delete" />  
  78.                     </td>  
  79.                 </tr>  
  80.             </table>  
  81.   
  82.   
  83.   
  84.   
  85. }  
  86.   
  87.             <hr />  
  88.             <br />  
  89.             <br />  
  90.             <div align="center">  
  91.                 <a href="/" style="font-size: 25px; font-weight: bold">Back to Index</a>  
  92.             </div>  
  93.         </div>  
  94.     </body>  
  95. </html>   
output

output
Similarly, we have to add a class to edit information for a particular user.

So for this, right click on Edit method in the controller and add a view page and give a name for example Edit.cshtml and write the code.

Edit.cshtml
  1. @{  
  2. Layout = null;  
  3.   
  4. }  
  5.   
  6. @using mvcRegistration.Models  
  7.   
  8. @model User  
  9.   
  10.   
  11. <!DOCTYPE html>  
  12. <html>  
  13.     <head>  
  14.         <meta name="viewport" content="width=device-width" />  
  15.         <title>Edit</title>  
  16.     </head>  
  17.     <body>  
  18.         <div align="center">  
  19.             <h1 align="center" style="background-color:aqua; color: maroon; border-radius: 15px; box-shadow: 7px 7px 7px7px darkgreen; width: 800px;">Edit Employee Details</h1>  
  20.         </div>  
  21.         <hr />  
  22.         <div>  
  23.   
  24. @using(Html.BeginForm())  
  25.   
  26. {   
  27.   
  28.             <table width="40%" border="2" align="center" style=" background-color: #4B2A2F; border: double solid maroon; font-weight: bold; color:white; padding: 5px 8px 4px 10px; border-color: white; font-size:20px; border-radius: 25px; box-shadow: 10px 10px 10px 10pxdarkgreen; font-weight: bold">  
  29.                 <tr>  
  30.                     <td>@Html.Label("User Id")</td>  
  31.                     <td>@Html.TextBox("UserId",Model.userId)</td>  
  32.                 </tr>  
  33.                 <tr>  
  34.                     <td>@Html.Label("First Name")</td>  
  35.                     <td>@Html.TextBox("FirstName",Model.firstName)</td>  
  36.                 </tr>  
  37.                 <tr>  
  38.                     <td>@Html.Label("Middle Name")</td>  
  39.                     <td>@Html.TextBox("MidleName",Model.middileName)</td>  
  40.                 </tr>  
  41.                 <tr>  
  42.                     <td>@Html.Label("Last Name")</td>  
  43.                     <td>@Html.TextBox("LastName",Model.lastName)</td>  
  44.                 </tr>  
  45.                 <tr>  
  46.                     <td>@Html.Label("Address")</td>  
  47.                     <td>@Html.TextBox("Addres",Model.address)</td>  
  48.                 </tr>  
  49.                 <tr>  
  50.                     <td>@Html.Label("Phone Number")</td>  
  51.                     <td>@Html.TextBox("FoneNo",Model.phoneNo)</td>  
  52.                 </tr>  
  53.                 <tr>  
  54.                     <td>@Html.Label("Email Id")</td>  
  55.                     <td>@Html.TextBox("EmailId",Model.EmailId)</td>  
  56.                 </tr>  
  57.                 <tr>  
  58.                     <td>@Html.Label("Password")</td>  
  59.                     <td>@Html.TextBox("Password",Model.password)</td>  
  60.                 </tr>  
  61.                 <tr>  
  62.                     <td>@Html.Label("Pine Code")</td>  
  63.                     <td>@Html.TextBox("PinCode",Model.pincode)</td>  
  64.                 </tr>  
  65.                 <tr>  
  66.                     <td colspan="2" align="center">  
  67.                         <input type="button"style="font-size:25px;align-content:center" value="Edit" />  
  68.                     </td>  
  69.                 </tr>  
  70.             </table>  
  71.   
  72. }   
  73.             <br />  
  74.             <br />  
  75.             <div align="center">  
  76.                 <a href ="/" align="center" style="font-size:25px;align-content:center">Back to Index</a>  
  77.             </div>  
  78.         </div>  
  79.     </body>  
  80. </html>  
output


Similar Articles