public PersonLanguage Create(PersonLanguage personLanguage)
        {
            _personListDbContext.PersonLanguages.Add(personLanguage);

            if (_personListDbContext.SaveChanges() > 0)
            {
                return(personLanguage);
            }

            return(null);
        }
Beispiel #2
0
        public Country Create(Country country)
        {
            _personListDbContext.Countries.Add(country);

            int result = _personListDbContext.SaveChanges();

            if (result == 0)
            {
                return(null);                                                // Not saved correctly in the database
            }

            return(country);
        }
Beispiel #3
0
        public Person Create(Person person)
        {
            personListDbContext.People.Add(person);

            int result = personListDbContext.SaveChanges();

            if (result == 0)                                                // No changes in the database
            {
                throw new Exception("Unable to create a person in the database.");
            }

            return(person);                                                  // A person is successfully created
        }
        public Language Create(Language language)
        {
            _personListDbContext.Add(language);

            if (_personListDbContext.SaveChanges() > 0)
            {
                return(language);
            }
            return(null);
        }
        public PersonGroup Create(PersonGroup personGroup)
        {
            _personListDbContext.PersonGroups.Add(personGroup);

            int result = _personListDbContext.SaveChanges();

            if (result == 0)
            {
                return(null);
            }

            return(personGroup);
        }