public JsonResult GetTercihListById(ListIdModel ListId) { try { tercih t = new tercih(); return(Json(t.GetTercihListByIdList(ListId), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { dbOp dbOp = new dbOp(); dbOp.errLog("Home", "GetTercihListById", ex.Source, ex.Message); return(Json(new { Result = false })); } }
public List <TercihListModel> GetTercihListByIdList(ListIdModel ListId) { //tercih list id'lerini al ve table value parametreye çevir DataTable dt = new DataTable(); string st = GetTercihList(ListId.Id); st = st == null ? "" : st; JavaScriptSerializer js = new JavaScriptSerializer(); List <ListIdModelInt> tl = js.ConvertToType <List <ListIdModelInt> >(js.DeserializeObject(st)); if (tl != null) { using (SqlConnection conn = new SqlConnection(myConn)) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = "dbo.GetTercihListByIdList"; cmd.CommandType = CommandType.StoredProcedure; SqlParameter parameter1 = cmd.Parameters.AddWithValue("@IdList", CreateDataTableForId(tl)); parameter1.SqlDbType = SqlDbType.Structured; parameter1.TypeName = "dbo.IDType3"; using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } } } return(ConvertToTercihListType(dt)); } else { return(ConvertToTercihListType(dt)); } }