public List<Deposit> GetAllDeposits() { XDocument doc = XDocument.Load(depositFile); List<Deposit> deposits = new List<Deposit>(); XNode node = doc.Root.FirstNode; while (node != null) { if (node.NodeType == System.Xml.XmlNodeType.Element) { Deposit deposit = new Deposit(); XElement el = (XElement)node; deposit.Name = el.Element("depositName").Value; deposit.InterestRate = Int32.Parse(el.Element("interestRate").Value); deposit.Currency = el.Element("currency").Value; deposits.Add(deposit); } node = node.NextNode; } return deposits; }
protected void addNewDeposit(Deposit dep, String depositName) { deposits.Add(depositName, dep); }