public static void GetAll(ORM ado) { Console.WriteLine(); foreach (var t in ado.GetAllTypes()) { Console.WriteLine("{0}\t{1}", t.Id, t.Name); } }
public static void Update(ORM orm) { bool checkUpdate = true; while (checkUpdate == true) { Console.Write("\nEnter the id you want to update: "); int id = Convert.ToInt32(Console.ReadLine()); if (id == 0) { checkUpdate = false; } var type = orm.GetAllTypes().Where(x => x.Id == id).FirstOrDefault(); Console.WriteLine("\nChoose the column you want to change:\n" + "1.Name\n" + "<-Back\n"); Console.Write(">>"); string choiceUpdate = Console.ReadLine(); try { switch (choiceUpdate) { case "Name": Console.Write("\nUpdate Name: "); string name = Console.ReadLine(); orm.Update(new Types { Id = type.Id, Name = name }); break; case "Back": checkUpdate = false; break; } } catch (Exception e) { Console.WriteLine(e.Message); } } }