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); }
public LivroesController(ILivro context, IAutor contextAutor, ICategoria contextCategoria, ILivroSituacao contextLivroSituacao) { _context = context; _contextAutor = contextAutor; _contextCategoria = contextCategoria; _contextLivroSituacao = contextLivroSituacao; }
public void RealizarEmprestimo(int id, DateTime d, IPessoa p, ILivro l) { Id = id; DataEmprestimo = d; Pessoa = p; Livro = l; }
private void BuildOutput(ILivro livro) { Livro Livro = (Livro)livro; var output = new IncluirLivroCarrinhoSaida(Livro); this._IncluirLivroCarrinhoSaidaPort.Standard(output); }
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); }
public async Task <ILivro> IncluirLivroNoCarrinho(ICarrinhoLivro CarrinhoLivro, Carrinho Carrinho, Livro Livro) { if (CarrinhoLivro is null) { throw new ArgumentNullException(nameof(CarrinhoLivro)); } if (Carrinho is null) { throw new ArgumentNullException(nameof(Carrinho)); } if (Livro is null) { throw new ArgumentNullException(nameof(Livro)); } ILivro livro = CarrinhoLivro.IncluirLivroCarrinho(this._CarrinhoFactory, Carrinho, Livro); ICarrinho carrinho = (ICarrinho)Carrinho; await this._CarrinhoRepository.AddLivro(CarrinhoLivro, carrinho, livro).ConfigureAwait(false); return(livro); }
public async Task Executar(CadastrarLivroEntrada entrada) { if (entrada is null) { this._CadastrarLivroSaidaPort.WriteError("Entrada não pode ser nula"); return; } ICadastroLivro CadastroLivro = await this._CadastroLivroRepository.GetCadastroLivro().ConfigureAwait(false); if (CadastroLivro is null) { this._CadastrarLivroSaidaPort.WriteError("Cadastro de livros não existe."); return; } ILivro livro = await this._CadastroLivroService.CadastrarLivro(CadastroLivro, new Livro() { autor = entrada.autor, isbn = entrada.isbn, nome = entrada.nome, preco = entrada.preco }); await this._unitOfWork.Save().ConfigureAwait(false); this.BuildOutput(livro.isbn.id); }
public MovimentacaosController(IMovimentacao context, ILivro contextLivro, IPessoa contextPessoa, IFuncionario contextFuncionario, IMovimentacaoSituacao contextMovimentacaoSituacao) { _context = context; _contextLivro = contextLivro; _contextPessoa = contextPessoa; _contextFuncionario = contextFuncionario; _contextMovimentacaoSituacao = contextMovimentacaoSituacao; }
public IEmprestimo Emprestar(IPessoa pessoa, ILivro livro, IEmprestimo emprestimo) { int id = 1; DateTime dataEmprestimo = DateTime.Now; emprestimo.RealizarEmprestimo(id, dataEmprestimo, pessoa, livro); return(emprestimo); }
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); }
public async Task <ILivro> CadastrarLivro(ICadastroLivro CadastroLivro, Livro Livro) { if (CadastroLivro is null) { throw new ArgumentNullException(nameof(CadastroLivro)); } if (Livro is null) { throw new ArgumentNullException(nameof(Livro)); } ILivro livro = CadastroLivro.IncluirLivro(this._CadastroLivroFactory, Livro); await this._CadastroLivroRepository.Add(CadastroLivro, livro) .ConfigureAwait(false); return(livro); }
public async Task <ILivro> AlterarLivro(ICadastroLivro CadastroLivro, Livro Livro) { if (CadastroLivro is null) { throw new ArgumentNullException(nameof(CadastroLivro)); } if (Livro is null) { throw new ArgumentNullException(nameof(Livro)); } ILivro livro = CadastroLivro.ALterarLivro(this._CadastroLivroFactory, Livro); if (livro != null) { await this._CadastroLivroRepository.Update(CadastroLivro, livro).ConfigureAwait(false); } return(livro); }
public async Task <ILivro> ExcluirLivro(ICadastroLivro CadastroLivro, Livro Livro) { if (CadastroLivro is null) { throw new ArgumentNullException(nameof(CadastroLivro)); } if (Livro is null) { throw new ArgumentNullException(nameof(Livro)); } bool result = false; result = CadastroLivro.ExcluirLivro(this._CadastroLivroFactory, Livro); ILivro livro = (ILivro)Livro; await this._CadastroLivroRepository.Delete(CadastroLivro, livro) .ConfigureAwait(false); return(livro); }
public async Task Executar(IncluirLivroCarrinhoEntrada entrada) { if (entrada is null) { this._IncluirLivroCarrinhoSaidaPort.WriteError("Entrada não pode ser nula"); return; } ICarrinhoLivro CarrinhoLivro = await this._CarrinhoRepository.GetCarrinhoLivro().ConfigureAwait(false); if (CarrinhoLivro is null) { this._IncluirLivroCarrinhoSaidaPort.WriteError("Carrinho não existe."); return; } ILivro livro = await this._CarrinhoService.IncluirLivroNoCarrinho(CarrinhoLivro, entrada.Carrinho, entrada.Livro); await this._unitOfWork.Save().ConfigureAwait(false); this.BuildOutput(livro); }
public async Task <ILivro> RemoverLivroDoCarrinho(ICarrinhoLivro CarrinhoLivro, Carrinho Carrinho, Livro Livro) { if (CarrinhoLivro is null) { throw new ArgumentNullException(nameof(CarrinhoLivro)); } if (Carrinho is null) { throw new ArgumentNullException(nameof(Carrinho)); } if (Livro is null) { throw new ArgumentNullException(nameof(Livro)); } bool result = CarrinhoLivro.ExcluirLivroCarrinho(this._CarrinhoFactory, Carrinho, Livro); ICarrinho carrinho = (ICarrinho)Carrinho; ILivro livro = (ILivro)Livro; if (result) { await this._CarrinhoRepository.DeleteLivro(CarrinhoLivro, carrinho, livro).ConfigureAwait(false); } else { livro = null; } return(livro); }
public IEmprestimo BuscarEmprestimoPorLivro(ILivro livro, List <IEmprestimo> listEmprestimo) { return(listEmprestimo.Where(x => x.GetLivro() == livro).FirstOrDefault()); }
public IEmprestimo BuscarEmprestimoPorLivro(IEmprestimo emprestimo, ILivro livro, List <IEmprestimo> listEmprestimo) { return(emprestimo.BuscarEmprestimoPorLivro(livro, listEmprestimo)); }
public LivroController(ILivro livro) { _livro = livro; }
public ILivro BuscarLivro(ILivro livro, int tombo, List <ILivro> listLivro) { return(livro.BuscarLivro(tombo, listLivro)); }
public LivroApp(ILivro ILivro) { _ILivro = ILivro; }
public LivrosController(ApplicationDbContext options) { this._livroRepositorio = new LivroImpl(options); }
public LivrosController(ILivro repositorio) { _repositorio = repositorio; }
public LivroApp(ILivro livro) : base(livro) { _iLivro = livro; }