public static void GetLocationFrom(String location, Estate estate) { if (location == "center") { Console.WriteLine("We have the next New York's streets address for the available " + estate.GetType().Name + "s: " + "Wall Street, Houston Street, Maiden Lane."); } else if (location == "somewhere ok") { Console.WriteLine("We have the next New York's streets address for the available " + estate.GetType().Name + "s: " + "Fulton Street ,Lafayette Street, Lenox Avenue."); } else if (location == "suburbs") { Console.WriteLine("We have the next New York's streets address for the available " + estate.GetType().Name + "s: " + "Upper Montclair, Kensington, Great Neck Gardens."); } }
private Estate CopyEstate(Estate estate) { Estate estateCopy; switch (estate.GetType().Name) { case "House": estateCopy = new House() { EstateId = estate.EstateId, LegalForm = estate.LegalForm, Address = estate.Address }; break; case "Apartment": estateCopy = new Apartment() { EstateId = estate.EstateId, LegalForm = estate.LegalForm, Address = estate.Address }; break; case "Shop": estateCopy = new Shop() { EstateId = estate.EstateId, LegalForm = estate.LegalForm, Address = estate.Address }; break; case "Townhouse": estateCopy = new Townhouse() { EstateId = estate.EstateId, LegalForm = estate.LegalForm, Address = estate.Address }; break; case "Villa": estateCopy = new Villa() { EstateId = estate.EstateId, LegalForm = estate.LegalForm, Address = estate.Address }; break; case "Warehouse": estateCopy = new Warehouse() { EstateId = estate.EstateId, LegalForm = estate.LegalForm, Address = estate.Address }; break; default: estateCopy = null; break; } return(estateCopy); }