Example #1
0
        public bool ExcluirLivro(ICadastroLivroFactory entidadeFactory, Livro Livro)
        {
            bool result = false;

            if (entidadeFactory is null)
            {
                throw new ArgumentNullException(nameof(entidadeFactory));
            }

            ILivro livro = Livros.Find(x => x.isbn.Equals(Livro.isbn));

            if (livro is null)
            {
                throw new ArgumentNullException(nameof(livro));
            }


            result = entidadeFactory.RemoveLivro(this, livro.isbn.id);
            if (result)
            {
                Livros.Remove(livro);
            }

            return(result);
        }
Example #2
0
        public ILivro ALterarLivro(ICadastroLivroFactory entidadeFactory, Livro Livro)
        {
            bool result = false;

            if (entidadeFactory is null)
            {
                throw new ArgumentNullException(nameof(entidadeFactory));
            }

            ILivro livro = Livros.Find(x => x.isbn.id.Equals(Livro.isbn.id));

            if (livro is null)
            {
                throw new ArgumentNullException(nameof(livro));
            }

            Livro.isbn.id = livro.isbn.id;

            result = entidadeFactory.AlterarLivro(this, Livro);
            if (result)
            {
                Livros.Remove(livro);
                Livros.Add(Livro);
            }

            return(Livro);
        }
Example #3
0
        public ILivro IncluirLivro(ICadastroLivroFactory entidadeFactory, Livro Livro)
        {
            if (entidadeFactory is null)
            {
                throw new ArgumentNullException(nameof(entidadeFactory));
            }

            ILivro livro = entidadeFactory.NovoLivro(this, Livro);

            Livros.Add(livro);
            return(livro);
        }
Example #4
0
 public ILivros GetLivros(ICadastroLivroFactory eitidadeFactory, int IdCadastro)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public CadastroLivroService(ICadastroLivroFactory CadastroLivroFactory, ICadastroLivroRepository CadastroLivroRepository)
 {
     _CadastroLivroFactory    = CadastroLivroFactory;
     _CadastroLivroRepository = CadastroLivroRepository;
 }