/// <summary> /// A method used to search through the database in order to find /// an air conditioner by manufacturer and model /// </summary> /// <param name="manufacturer">The manufacturer you would be searching for</param> /// <param name="model"> The model that you would be searching for</param> /// <returns>returns a string with the specifications of the found device</returns> public string FindAirConditioner(string manufacturer, string model) { IAirConditioner airConditioner = database.GetAirConditioner(manufacturer, model); if (airConditioner == null) { throw new NonExistantEntryException(); } return(airConditioner.ToString()); }
public void FindAirConditioner(string manufacturer, string model) { try { IAirConditioner airConditioner = data.GetAirConditioner(manufacturer, model); writer.WriteLine(airConditioner.ToString()); } catch (NullReferenceException) { writer.WriteLine("The specified entry does not exist."); } }
/// <summary> /// A method that finds an Air Conditioner in the database from a given manufacturer and model. /// </summary> /// <param name="manufacturer">The Manufacturer of the searched air conditioner.</param> /// <param name="model">The model of the searched air conditioner.</param> /// <returns>If the air conditioner exists in the database returns it's string represention, othrerwise it throws an appropriate exception.</returns> public string FindAirConditioner(string manufacturer, string model) { IAirConditioner airConditioner = this.Database.AirConditioners.GetItem(manufacturer, model); return(airConditioner.ToString()); }