Check out example codes for "Generate Genealogy view in mvc C# using Google Organizational Chart". It will help you in understanding the concepts better.

Code Example 1

//*
[WebMethod]
public List<Google_org_data> getOrgData()
{
	List<Google_org_data> g = new List<Google_org_data>();
	DataTable myData = getDataTable();

	g.Add(new Google_org_data {
				Employee = "Rocky Balboa",
				Manager = "",
				mgrID = "",
				empID = "13",
				designation = "CEO"
			});

	foreach (DataRow row in myData.Rows)
	{
		string empName = row["EmpName"].ToString();
		var mgrName = row["MgrName"].ToString();
		var mgrID = row["mgrID"].ToString();
		var empID = row["empID"].ToString();
		var designation = row["designation"].ToString();

		g.Add(new Google_org_data{
					Employee = empName,
					Manager = mgrName,
					mgrID = mgrID,
					empID = empID,
					designation = designation
				});
	}
	return g;
}

public DataTable getDataTable()
{

	DataTable dt = new DataTable();
	string query = " select a.employee_name as EmpName,a.id_emp as empID,a.designation,b.employee_name as MgrName,b.id_emp as mgrID";
	query += " from tb_employee a inner join tb_employee b on a.manager_id=b.id_emp";
	SqlDataAdapter dap = new SqlDataAdapter(query, con);
	DataSet ds = new DataSet();
	dap.Fill(ds);
	return ds.Tables[0];
}
//*

Learn ReactJs, React Native from akashmittal.com