This is my code
public void Add(Employee newEmployee)
{
XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("StudentDB.xml"));
//doc.Element("NewEmployees");
empList.Add(new Employee
{
EmpNo = newEmployee.EmpNo,
EmpName = newEmployee.EmpName,
DeptName = newEmployee.DeptName,
AllDepart = new List<Department> { new Department() { DeptNo = newEmployee.AllDepart[0].DeptNo, Dname = newEmployee.AllDepart[0].Dname, Location = newEmployee.AllDepart[0].Location } },
AllSales = new List<Sales> { new Sales() { SName = newEmployee.AllSales[0].SName, Orders = new List<Order> { new Order() { Oid = Convert.ToInt32(newEmployee.AllSales[0]), OName = "ebay" } } } },
Purchages =new List<Purchage> { new Purchage () { Id=Convert.ToInt32(newEmployee.Purchages[0]),IName=newEmployee.Purchages[0].ToString()}}
});
doc.Save(HttpContext.Current.Server.MapPath("StudentDB.xml"));
}
where is mistake in my code above.