示例#1
0
        public static Author AddAuthor(string firstName, string lastName, string country)
        {
            using (var ctx = new BooksEntities1())
            {
                Author newAuthor = new Author();
                newAuthor.FirstName          = firstName;
                newAuthor.LastName           = lastName;
                newAuthor.CountryOfResidence = country;

                ctx.Authors.Add(newAuthor);
                ctx.SaveChanges();
                return(newAuthor);
            }
        }