Using CRUD in an asp.net MVC application without Entity Framework
<p>I am trying to achieve CRUD operation in MVC using SQL without using the Entity Framework. I've done well with insert but when coming to Update, View details and delete I am confused how to perform, so can some one help me out?</p>

<p>This is my code for creating:</p>

<p>My Model:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.ComponentModel.DataAnnotations;


namespace Test.Models
{
    public class Customers
    {
        public int CustomerID { get; set; }
        [Required]
        [Display(Name = "First Name")]
        public string FirstName { get; set; }
        [Required]
        [Display(Name = "Last Name")]
        public string LastName { get; set; }
        [Required]
        [Display(Name = "Address Line 1")]
        public string AddressLine1 { get; set; }
        [Required]
        [Display(Name = "Address Line 2")]
        public string AddressLine2 { get; set; }
        [Required]
        [Display(Name = "City")]
        public string City { get; set; }
        [Required]
        [Display(Name = "Postcode")]
        public string Postcode { get; set; }
        [Required]
        [Display(Name = "Phone No")]
        public string Phone { get; set; }

        string strConnection = ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString.ToString();


        public void insert(Customers customers)
        {
            using (SqlConnection con = new SqlConnection(strConnection))
            {
                string sql = "insert into Customers values('" + customers.FirstName + "','" + customers.LastName + "','" + customers.AddressLine1 + "','" + customers.AddressLine2 + "','" + customers.City + "','" + customers.Postcode + "','" + customers.Phone + "')";
                SqlCommand cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.ExecuteNonQuery();
            }
        }
    }
}
</code></pre>

<p>My Controller:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Test.Models;

namespace Test.Controllers
{
    public class CustomersController : Controller
    {
        // GET: Customers
        public ActionResult AddCustomerForm()
        {
            return View();
        }

        [HttpPost]
        public ActionResult AddCustomerForm(FormCollection formCollection)
        {

            Customers customers = new Customers();
            customers.FirstName = formCollection["FirstName"];
            customers.LastName = formCollection["LastName"];
            customers.AddressLine1 = formCollection["AddressLine1"];
            customers.AddressLine2 = formCollection["AddressLine2"];
            customers.City = formCollection["City"];
            customers.Postcode = formCollection["Postcode"];
            customers.Phone = formCollection["Phone"];

            customers.insert(customers);
            return View("CustomerRegSuccess", customers);

        }
    }
}
</code></pre>