Hi
I have belwo for all Customers. What will bet the procedure for GetById & how to fecth in Controller
public List<Customer> GetAllCustomer()
{
List<Customer> objCustomer = new List<Customer>();
using (SqlConnection con = new SqlConnection(Common.Con))
{
con.Open();
SqlCommand cmd = new SqlCommand("sp_Customer", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Action", "R");
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
objCustomer.Add(new Customer
{
Id = rdr["Id"].ToString(),
Description = rdr["Description"].ToString(),
IsActive = Convert.ToBoolean(rdr["IsActive"]),
});
}
return objCustomer;
}
}
Thanks