Exemplo 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();
            }
        }
Exemplo n.º 2
0
        public List<Book> Create(Book book)
        {
            using (var context = new AuthorDbContext())
            {
                context.Books.Add(book);

                context.SaveChanges();

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

                context.SaveChanges();

                return context.Authors.ToList();
            }
        }
Exemplo 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();
            }
        }