In the following code, I want to retrieve all those records whose Q_ID equals to the ID. Currently, I Select whole records instead of few. Please help me to solve this problem
public ActionResult Solution(int ID)
{
Answers ans_obj = new Answers();
List<Ans_Table> dbobj= db.Ans_Table.ToList();
List<Answers> ansobj = dbobj.Select(x => new Answers
{
Answer = x.Answer,
Q_ID=x.Q_ID,
U_ID=x.U_ID
}).ToList();
return View();
}