public ChitietSP BS_ChitietSP(int id) { try { ChitietSP ct_sp = new ChitietSP(); var _id = new SqlParameter { ParameterName = "id", Value = id }; var _id2 = new SqlParameter { ParameterName = "id", Value = id }; var _id3 = new SqlParameter { ParameterName = "id", Value = id }; ct_sp = db.Database.SqlQuery <ChitietSP>( "thongtinsp_theoid @id", _id).FirstOrDefault(); if (ct_sp != null) { List <ImgProduct> lst = new List <ImgProduct>(); lst = db.Database.SqlQuery <ImgProduct>("ds_anhsp_theoid_sp @id", _id2).ToList(); ct_sp.LstImg = lst; List <AttrProduct> lstAttr = new List <AttrProduct>(); lstAttr = db.Database.SqlQuery <AttrProduct>("ds_thuoctinh_sp_theoid_sp @id", _id3).ToList(); ct_sp.LstAttrProduct = lstAttr; } return(ct_sp); } catch (Exception e) { return(null); } }