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);
        }