Example #1
0
        public Author AddAuthor(AuthorInputType author)
        {
            var authorObj = new Author()
            {
                Name    = author.Name,
                Surname = author.Surname,
            };

            context.Add(authorObj);
            context.SaveChanges();
            return(authorObj);
        }
Example #2
0
        public Book AddBook(BookInputType book)
        {
            var bookObj = new Book()
            {
                AuthorId = book.AuthorId,
                Title    = book.Title,
                Price    = book.Price
            };

            context.Add(bookObj);
            context.SaveChanges();
            return(bookObj);
        }
Example #3
0
        public Author AddAuthor(AuthorInputType authorInputType)
        {
            var author = new Author()
            {
                Name    = authorInputType.Name,
                Surname = authorInputType.SurName
            };

            _dbContext.Author.Add(author);
            _dbContext.SaveChanges();

            return(author);
        }
Example #4
0
        public Book AddBook(BookInputType bookInputType)
        {
            var book = new Book()
            {
                Title    = bookInputType.Title,
                AuthorId = bookInputType.AuthorId,
                Price    = bookInputType.Price
            };

            _dbContext.Book.Add(book);
            _dbContext.SaveChanges();

            return(book);
        }