Please try with the below code snippet.
public ActionResult LoadMenu(int? id)
{
List<TreeModel> list = new List<TreeModel> {
new TreeModel() { ID=1, Name="Setup", URL="m.facebook.com", HasChild=true},
new TreeModel() { ID=10, Name="Leave", URL="google.com", ParentsID=1, HasChild=false},
new TreeModel() { ID=2, Name="EmployeeInfo", URL="m.facebook.com", HasChild=true},
new TreeModel() { ID=11, Name="Basic Employee", URL="m.facebook.com", HasChild=false, ParentsID=2},
};
var nodes = (from n in list
where (id.HasValue ? n.ParentsID == id.Value : n.ParentsID == null)
select n).ToList();
return Json(nodes, JsonRequestBehavior.AllowGet);
}