示例#1
0
        public void DeleteCountry(Guid countryId)
        {
            List <PersonalUser> persUsers = _personalUserRepository.GetUsersWithCountry(countryId);

            if (persUsers.Count > 0)
            {
                throw new ReferentialConstraintViolationException("Value of country is referenced in another table");
            }
            List <CorporationUser> corpUsers = _corporationUserRepository.GetUsersWithCountry(countryId);

            if (corpUsers.Count > 0)
            {
                throw new ReferentialConstraintViolationException("Value of country is referenced in another table");
            }
            _countryRepository.DeleteCountry(countryId);
            _countryRepository.SaveChanges();
        }