static void ExcluirLivro() { Negocio negocio = new Negocio(); IEmprestimoDado emprestimo; ILivroDado livro; do { livro = new LivroDado(); Console.Write("Digite o tombo para Excluir: "); int tombo = Convert.ToInt32(Console.ReadLine()); livro = negocio.BuscarLivro(livro, tombo, livros); if (livro == null) { Console.WriteLine("Livro invalido, tente novamente!!"); } } while (livro == null); emprestimo = new EmprestimoDado(); emprestimo = negocio.BuscarLivroEmprestimo(emprestimo, livro, emprestimos); if (emprestimo == null) { livros.Remove(livro); Console.WriteLine("Livro removido com sucesso!!"); } else { Console.WriteLine("Livro sendo usado!!"); } }
static void PesquisarLivro() { Negocio negocio = new Negocio(); ILivroDado livro; do { livro = new LivroDado(); Console.Write("Digite o tombo para Pesquisa: "); int tombo = Convert.ToInt32(Console.ReadLine()); livro = negocio.BuscarLivro(livro, tombo, livros); if (livro == null) { Console.WriteLine("Livro invalido, tente novamente!!"); } } while (livro == null); livro.ImprimirLivroDado(); }
static void CadastrarLivro() { string titulo, autor; do { Console.Write("Informe o titulo: "); titulo = Console.ReadLine(); } while (string.IsNullOrEmpty(titulo)); do { Console.Write("Informe o autor: "); autor = Console.ReadLine(); } while (string.IsNullOrEmpty(autor)); ILivroDado livro = new LivroDado(livros.Count, titulo, autor); livros.Add(livro); Console.WriteLine("Livro Cadastrado!!"); }
static void AlugarLivro() { Negocio biblioteca = new Negocio(); IEmprestimoDado emprestimo = new EmprestimoDado(); IPessoaDado pessoaDado; ILivroDado livroDado; do { pessoaDado = new PessoaDado(); livroDado = new LivroDado(); Console.Write("Informe o cpf: "); int cpf = Convert.ToInt32(Console.ReadLine()); Console.Write("Informe o tombo do livro: "); int tombo = Convert.ToInt32(Console.ReadLine()); pessoaDado = biblioteca.BuscarPessoa(pessoaDado, cpf, pessoas); livroDado = biblioteca.BuscarLivro(livroDado, tombo, livros); } while (pessoaDado == null || livroDado == null); emprestimos.Add(biblioteca.Emprestar(livroDado, pessoaDado, emprestimo, emprestimos)); Console.WriteLine("Emprestimo realizado!!"); }