Ejemplo n.º 1
0
        public PersonLanguage Create(PersonLanguage personLanguage)
        {
            _personListDbContext.PersonLanguages.Add(personLanguage);

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

            return(null);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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
        }
Ejemplo n.º 4
0
        public Language Create(Language language)
        {
            _personListDbContext.Add(language);

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

            int result = _personListDbContext.SaveChanges();

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

            return(personGroup);
        }