/// <summary>Validations done to an country for the passed primary key before it is deleted.</summary> /// <param name="primaryKey">The primary key of the country to delete.</param> /// <exception cref="GTSport_DT.Countries.CountryNotFoundException">When the country can not be found to be deleted.</exception> /// <exception cref="GTSport_DT.Countries.CountryInUseException">When the country is used in one or more manufactures and the user tries to delete.</exception> public override void ValidateDelete(string primaryKey) { Country country = countriesRespository.GetById(primaryKey); if (country == null) { throw new CountryNotFoundException(CountryNotFoundException.CountryKeyNotFoundMsg, primaryKey); } List <Manufacturer> manufacturers = manufacturersRepository.GetListForCountryKey(primaryKey); if (manufacturers.Count > 0) { throw new CountryInUseException(CountryInUseException.CountryInUseCanNotBeDeletedManufacturerMsg); } }