Esempio n. 1
0
        public List<Author> EditComplite(Author author)
        {
            using (var context = new AuthorDbContext())
            {
                context.Entry(author).State = EntityState.Modified;
                context.SaveChanges();

                return context.Authors.ToList();
            }
        }
Esempio n. 2
0
        public List<Book> Create(Book book)
        {
            using (var context = new AuthorDbContext())
            {
                context.Books.Add(book);

                context.SaveChanges();

                return context.Books.ToList();
            }
        }
Esempio n. 3
0
        public List<Author> Create(Author author)
        {
            using (var context = new AuthorDbContext())
            {
                context.Authors.Add(author);

                context.SaveChanges();

                return context.Authors.ToList();
            }
        }
Esempio n. 4
0
        public List<Author> DeleteConfirmed(int id)
        {
            using (var context = new AuthorDbContext())
            {
                Author author = context.Authors.Find(id);

                context.Authors.Remove(author);

                context.SaveChanges();

                return context.Authors.ToList();
            }
        }