public int GetInterestRate() { int rate =0; XmlParser xmlp = new XmlParser(); List<Deposit> deposits = xmlp.GetAllDeposits(); foreach (var dpst in deposits) { if(dpst.GetName().Equals(nameDeposit)) rate= dpst.GetInterestRate(); } return rate; }
public static User addUser() { User us = new User(); XmlParser xmlp = new XmlParser(); Console.WriteLine("Введите ФИО:"); us.fio = Console.ReadLine(); Console.WriteLine("Депозиты:"); List<Deposit> deposits = xmlp.GetAllDeposits(); for (int i = 0; i < deposits.Count; i++) { Console.WriteLine(i + "." + deposits[i].GetName()); } Console.WriteLine("Введите номер:"); us.depositName = deposits[int.Parse(Console.ReadLine())].GetName(); Console.WriteLine("Введите сумму:"); us.Summa = double.Parse(Console.ReadLine()); us.Date = DateTime.Now.Date; xmlp.AddUser(us); return us; }