static void salir(List <Reservacion> reservaciones) { if (reservaciones.Count == 0) { Console.WriteLine("No hay reservaciones ocupadas"); return; } int correlative = 0; Console.WriteLine("\nReservaciones ocupadas"); reservaciones.ForEach(it => { Console.WriteLine(it.Info()); }); Console.WriteLine("Ingrese su correlativo para salir"); correlative = Convert.ToInt32(Console.ReadLine()); Reservacion reservacion = reservaciones.Find(it => it.correlative == correlative); reservacion.ocupated = false; switch (reservacion.cuarto) { case Hotel h: Console.WriteLine(h.outKey()); reservaciones.RemoveAll(it => it.correlative == correlative); break; case Cabin c: Console.WriteLine(c.outKey()); reservaciones.RemoveAll(it => it.correlative == correlative); Console.WriteLine(c.outWood()); reservaciones.RemoveAll(it => it.correlative == correlative); break; case Hut h: Console.WriteLine(h.outKey()); reservaciones.RemoveAll(it => it.correlative == correlative); Console.WriteLine(h.outWood()); reservaciones.RemoveAll(it => it.correlative == correlative); Console.WriteLine(h.outOil()); reservaciones.RemoveAll(it => it.correlative == correlative); break; default: break; } }
static void llegar(List <Reservacion> reservaciones) { if (reservaciones.Count == 0) { Console.WriteLine("No hay reservaciones"); return; } int correlative = 0; Console.WriteLine("\nReservaciones disoponibles"); reservaciones.ForEach(it => { Console.WriteLine(it.Info()); }); Console.WriteLine("Ingrese su correlativo de reservacion"); correlative = Convert.ToInt32(Console.ReadLine()); Reservacion reservacion = reservaciones.Find(it => it.correlative == correlative); reservacion.ocupated = true; switch (reservacion.cuarto) { case Hotel h: Console.WriteLine(h.inKey()); break; case Cabin c: Console.WriteLine(c.inKey()); Console.WriteLine(c.inWood()); break; case Hut h: Console.WriteLine(h.inKey()); Console.WriteLine(h.inWood()); Console.WriteLine(h.inOil()); break; default: break; } }