public static void ChangeData(List <WorkingDay> Days) { Console.WriteLine("Enter date of day that`s you want to change"); var s = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy", null); WorkingDay day = Days.Find(x => x.Date == s); if (day != null) { Console.WriteLine("Enter value of day that`s you want to change \n1)Name\n2)Adress\n3)Date like 01.06.2020\n4)Book Out\n5)Book In"); char a = Console.ReadKey().KeyChar; Console.WriteLine("Enter new value"); switch (a) { case '1': day.Name = Console.ReadLine(); break; case '2': day.Adress = Console.ReadLine(); break; case '3': day.Date = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy", null); break; case '4': day.BookOutCount = Convert.ToInt16(Console.ReadLine()); break; case '5': day.BookInCount = Convert.ToInt16(Console.ReadLine()); break; } } }
public static WorkingDay CreateNewDay() { Console.Clear(); WorkingDay Day = new WorkingDay(); Console.WriteLine("Enter Name of library"); Day.Name = Console.ReadLine(); Console.WriteLine("Enter adress of library"); Day.Adress = Console.ReadLine(); Console.WriteLine("Enter date of day like 01.06.2020"); Day.Date = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy", null); Console.WriteLine("Enter Book in the library"); Day.BookInCount = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter Book not in the library"); Day.BookOutCount = Convert.ToInt16(Console.ReadLine()); return(Day); }