Hi
I have 2 classes . Cab both be combined together in one . Since bith r having same entity
public class Customer
{
public Customer()
{
}
[Key]
public string Id { get; set; }
[Display(Name = "Description")]
public string Description { get; set; }
[Display(Name = "Active")]
public bool IsActive { get; set; }
}
***********************************************************
public class CustomerDb
{
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;
}
}
}