public ActionResult EditRequest(string reqno) { using (var con = new SqlConnection(_connectionString)) { var result = con.Query <EditRepairStatus>("GetDataByCCNO", new { CC_NO = reqno }, commandType: CommandType.StoredProcedure).FirstOrDefault(); var Problem = con.Query <GetProblem_Child_Order_problem>("GetProblem_From_Child_Order_problem", new { CC_NO = result.CcNo }, commandType: CommandType.StoredProcedure).ToList(); foreach (var item in Problem) { var result1 = con.Query <string>("select Problem from mstdeviceproblem WHERE ProblemId =@ProblemId ", new { @ProblemId = item.ProblemId }, commandType: CommandType.Text).FirstOrDefault(); //var ProblemName = con.Query<string>("select Problem from mstdeviceproblem where ProblemID@ProblemID", new { @ProblemID = item.ProblemId}, commandType: CommandType.Text).FirstOrDefault(); item.ProblemName = result1; } result.CallStatusList = new SelectList(dropdown.BindCallStatus(), "Value", "Text"); result.ProblemList = new SelectList(dropdown.BindMstDeviceProblem(), "Value", "Text"); if (Problem != null) { result.Pro = Problem; } else { new List <GetProblem_Child_Order_problem>(); } return(View(result)); } }