private static string MakeTea() { Console.Clear(); Console.WriteLine("------------ Select tea to prepare ------------"); DataContext.GetDataTableFromTextFile() .AsEnumerable() .Select(x => x[0]) .ToList() .ForEach(Console.WriteLine); Console.WriteLine("Input tea name: "); ITea tea = new Tea(Console.ReadLine()); Console.Clear(); Console.WriteLine($"{tea.TeaName} temperature: "); double.TryParse(Console.ReadLine(), out double temp); Console.WriteLine($"Amount of time you want to spend brewing {tea.TeaName} (seconds): "); double.TryParse(Console.ReadLine(), out double time); var result = tea.PrepareTea(time, temp); SaveFile(result4, new [] { result }); return(result); }
private static void MakeSeveralTeas() { List <string> teaList = new List <string>(); foreach (var lineTea in File.ReadAllLines(batchFile)) { ITea tea = new Tea(lineTea.Split(new string[] { ", " }, StringSplitOptions.None)[0]); teaList .Add(tea.TeaName + ", " + tea.PrepareTea( temp: double.Parse(lineTea.Split(new string[] { ", " }, StringSplitOptions.None)[1]), time: double.Parse(lineTea.Split(new string[] { ", " }, StringSplitOptions.None)[2]))); } SaveFile(result5, teaList.ToArray()); Console.WriteLine($"Files was saved in {AppDomain.CurrentDomain.BaseDirectory}"); }