/// <summary> /// Get all satellite from a rocket /// </summary> /// <param name="rocketName"></param> /// <returns></returns> public List <Satellite> GetSatellites(string rocketName) { if (string.IsNullOrWhiteSpace(rocketName)) { throw new System.ArgumentException(Constants.CONST_ARG_EXECPTION, "rocketName"); } var rocket = _cargorocketInventory.GetRocket(rocketName); return(rocket.satellites); }
/// <summary> /// Gets all satellite in a rocket of input catagory type /// </summary> /// <param name="criteria"></param> /// <param name="rocketName"></param> /// <returns></returns> public List <Satellite> GetAllSatellites(string criteria, string rocketName) { if (string.IsNullOrWhiteSpace(rocketName)) { throw new System.ArgumentException(Constants.CONST_ARG_EXECPTION, "rocketName"); } if (string.IsNullOrWhiteSpace(criteria)) { throw new System.ArgumentException(Constants.CONST_ARG_EXECPTION, "criteria"); } List <Satellite> response = null; var rocket = _cargorocketInventory.GetRocket(rocketName); if (rocket != null && rocket.satellites != null) { foreach (var satellite in rocket.satellites) { if (satellite != null && !string.IsNullOrWhiteSpace(satellite.Catagory) && satellite.Catagory.Equals(criteria)) { if (response == null) { response = new List <Satellite>(); } response.Add(satellite); } } } return(response); }