public bool Delete(Country country)
        {
            Country OrGcountry = Read(country.Id);

            if (OrGcountry == null)
            {
                return(false);
            }

            _peopleDbContext.Remove(OrGcountry);
            int saveResult = _peopleDbContext.SaveChanges();

            if (saveResult == 0)//no changes in the database
            {
                return(false);
            }
            return(true);
        }
        public bool Delete(City city)
        {
            if (city == null)
            {
                return(false);
            }
            else
            {
                City originalCity = Read(city.Id);
                if (originalCity == null)
                {
                    return(false);
                }

                _dbContext.Remove(originalCity);
                int saveResult = _dbContext.SaveChanges();

                if (saveResult == 0)//no changes in the database
                {
                    return(false);
                }
                return(true);
            }
        }
示例#3
0
        public bool Delete(Person person)
        {
            if (person == null)
            {
                return(false);
            }
            else
            {
                Person originalPerson = Read(person.Id);
                if (originalPerson == null)
                {
                    return(false);
                }

                _peopleDbContext.Remove(originalPerson);
                int saveResult = _peopleDbContext.SaveChanges();

                if (saveResult == 0)//no changes in the database
                {
                    return(false);
                }
                return(true);
            }
        }
        public bool Delete(Language language)
        {
            if (language == null)
            {
                return(false);
            }
            else
            {
                Language originalLanguage = Read(language.Id);
                if (originalLanguage == null)
                {
                    return(false);
                }

                _peopleDbContext.Remove(originalLanguage);
                int saveResult = _peopleDbContext.SaveChanges();

                if (saveResult == 0)//no changes in the database
                {
                    return(false);
                }
                return(true);
            }
        }
示例#5
0
        public bool Delete(Language language)
        {
            if (language == null)
            {
                return(false);
            }
            else
            {
                Language origLanguage = Read(language.Id);
                if (origLanguage == null)
                {
                    return(false);
                }

                _peopleDbContext.Remove(origLanguage);
                int Result = _peopleDbContext.SaveChanges();

                if (Result == 0)
                {
                    return(false);
                }
                return(true);
            }
        }