Exemplo n.º 1
0
        public void DeleteAuthor(AuthorInputType authorInputType)
        {
            var author = _dbContext.Author.Where(x => x.Id == authorInputType.Id).FirstOrDefault();

            _dbContext.Author.Remove(author);
            _dbContext.SaveChanges();
        }
Exemplo n.º 2
0
        public void DeleteAuthor(AuthorInputType author)
        {
            var auth = _context.Author.Where(z => z.Id == author.Id).FirstOrDefault();

            _context.Author.Remove(auth);
            _context.SaveChanges();
        }
        public Author DeleteAuthor(AuthorInputType author)
        {
            var bk = _context.Author.Where(b => b.Id == b.Id).FirstOrDefault();

            _context.Author.Remove(bk);
            _context.SaveChanges();
            return(bk);
        }
Exemplo n.º 4
0
        public void DeleteAuthor(AuthorInputType author)
        {
            var authorObj = context.Author.FirstOrDefault(authorTmp => authorTmp.Id == author.Id);

            if (authorObj != null)
            {
                context.Author.Remove(authorObj);
                context.SaveChanges();
            }
        }
Exemplo n.º 5
0
        public void UpdateAuthor(AuthorInputType author)
        {
            var auth = _context.Author.Where(z => z.Id == author.Id).FirstOrDefault();

            auth.Name    = author.Name;
            auth.Surname = author.Surname;

            _context.Author.Update(auth);
            _context.SaveChanges();
        }
        public Author UpdateAuthor(AuthorInputType author)
        {
            var bk = _context.Author.Where(b => b.Id == b.Id).FirstOrDefault();

            bk.Name    = author.Name;
            bk.Surname = author.Surname;
            _context.Author.Update(bk);
            _context.SaveChanges();
            return(bk);
        }
Exemplo n.º 7
0
        public Author AddAuthor(AuthorInputType author)
        {
            var authorObj = new Author()
            {
                Name    = author.Name,
                Surname = author.Surname,
            };

            context.Add(authorObj);
            context.SaveChanges();
            return(authorObj);
        }
Exemplo n.º 8
0
        public Author UpdateAuthor(AuthorInputType authorInputType)
        {
            var author = _dbContext.Author.Where(x => x.Id == authorInputType.Id).FirstOrDefault();

            author.Name    = authorInputType.Name;
            author.Surname = authorInputType.SurName;

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

            return(author);
        }
Exemplo n.º 9
0
        public Author AddAuthor(AuthorInputType author)
        {
            var auth = new Author
            {
                Name    = author.Name,
                Surname = author.Surname
            };

            _context.Author.Add(auth);
            _context.SaveChanges();
            return(auth);
        }
Exemplo n.º 10
0
        public Author AddAuthor(AuthorInputType authorInputType)
        {
            var author = new Author()
            {
                Name    = authorInputType.Name,
                Surname = authorInputType.SurName
            };

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

            return(author);
        }
        public Author AddAuthor(AuthorInputType author)
        {
            var bk = new Author()
            {
                Id      = author.Id,
                Name    = author.Name,
                Surname = author.Surname
            };

            _context.Author.Add(bk);
            _context.SaveChanges();
            return(bk);
        }
Exemplo n.º 12
0
        public Author UpdateAuthor(AuthorInputType author)
        {
            var authorObj = context.Author.FirstOrDefault(authorTmp => authorTmp.Id == author.Id);

            if (authorObj != null)
            {
                authorObj.Name    = author.Name;
                authorObj.Surname = author.Surname;

                context.Author.Update(authorObj);
                context.SaveChanges();
            }

            return(authorObj ?? new Author());
        }