public void Run() { Console.Clear(); Console.WriteLine("Give a number of Estate :"); try { int num = int.Parse(Console.ReadLine()); var estate = _iDatabase.GetEstate(num); Console.WriteLine("\nEstate details\n====================="); EstatePrinter.Print(estate); } catch (FormatException ex) { Console.WriteLine("Incorrect number. " + ex.Message); Program.LogException(ex); } catch (InvalidOperationException ex) { Console.WriteLine("Number does not exist in database. " + ex.Message); Program.LogException(ex); } catch (OverflowException ex) { Console.WriteLine("Two large input value. " + ex.Message); Program.LogException(ex); } }
public void Run() { Console.Clear(); var estates = _iDatabase.GetAllEstates(); Console.WriteLine("List of estates: \n===================="); EstatePrinter.PrintList(estates); }
private static void ShowAllEstates() { if (_database.IsEmpty()) { Console.WriteLine("Brak jakiejkolwiek nieruchomości!"); Console.ReadLine(); } else { EstatePrinter.PrintEstates(_database.GetEstates()); } }
private static void ShowEstate() { if (!IsEstateInDatabase(out int id)) { Console.WriteLine("Brak nieruchomości o podanym numerze!"); Console.ReadLine(); } else { EstatePrinter.PrintEstate(_database.GetEstate(id)); } }