public async Task <IActionResult> Put(int id, EmprestimoLivro obj)
        {
            if (id == 0)
            {
                Response.StatusCode = 400;
                return(NotFound());
            }

            await emprestimoLivroService.Update(id, obj);

            return(Ok());
        }
        public void Salvar(EmprestimoLivro emprestimo)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append($"{emprestimo.IdCliente};");
            sb.Append($"{emprestimo.NumeroTombo};");
            sb.Append($"{emprestimo.DataEmprestimo:dd/MM/yyyy};");
            sb.Append($"{emprestimo.DataDevolucao:dd/MM/yyyy};");
            sb.Append($"{emprestimo.StatusEmprestimo}");

            using (StreamWriter sw = new StreamWriter(filePath, true))
            {
                sw.WriteLine(sb.ToString());
            }
        }
Example #3
0
        public static List <EmprestimoLivro> ConverteParaListaEmprestimo()
        {
            List <EmprestimoLivro> EmprestimoLivro = new List <EmprestimoLivro>();

            try
            {
                ManipuladorArquivo file = new ManipuladorArquivo()
                {
                    Path = @"C:\Arquivos\", Name = "EMPRESTIMO.CSV"
                };
                string[] emprestimoArquivados = ManipuladorArquivoControle.LerArquivo(file);


                foreach (var emprestado in emprestimoArquivados)
                {
                    if (emprestado.Length == 35)
                    {
                        string idcliente        = emprestado.Substring(0, 5);
                        string numerotombo      = emprestado.Substring(6, 5);
                        string dataemprestimo   = emprestado.Substring(12, 10);
                        string datadevolucao    = emprestado.Substring(23, 10);
                        string statusemprestimo = emprestado.Substring(34, 1);



                        EmprestimoLivro novoEmprestimo = new EmprestimoLivro()
                        {
                            IdCliente        = long.Parse(idcliente),
                            NumeroTombo      = long.Parse(numerotombo),
                            DataEmprestimo   = Convert.ToDateTime(dataemprestimo),
                            DataDevolucao    = Convert.ToDateTime(datadevolucao),
                            StatusEmprestimo = int.Parse(statusemprestimo)
                        };


                        EmprestimoLivro.Add(novoEmprestimo);
                    }
                }
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine("ERRO!!!!: " + ex.Message);
                Console.ReadKey();
            }

            return(EmprestimoLivro);
        }
Example #4
0
        public async Task Update(int id, EmprestimoLivro obj)
        {
            var objOri = repositoryLivroEmprestimo.Find(id).Result;

            objOri.UsuarioId     = obj.UsuarioId;
            objOri.LivroId       = obj.LivroId;
            objOri.Habilitado    = obj.Habilitado;
            objOri.DataDevolucao = obj.DataDevolucao;
            objOri.Devolvido     = obj.Devolvido;

            if (obj.Devolvido)
            {
                objOri.DataDevolvido = DateTime.Now;
            }

            await repositoryLivroEmprestimo.Update(objOri);
        }
        public List <EmprestimoLivro> Leitura()
        {
            List <string> lines = base.Leitura(fileName);

            List <EmprestimoLivro> emprestimos = new List <EmprestimoLivro>();

            for (int i = 1; i < lines.Count(); i++)
            {
                string          line           = lines[i];
                EmprestimoLivro emprestimoLine = new EmprestimoLivro();

                string[] emprestimocsv = line.Split(';');
                emprestimoLine.IdCliente        = long.Parse(emprestimocsv[0]);
                emprestimoLine.NumeroTombo      = long.Parse(emprestimocsv[1]);
                emprestimoLine.DataEmprestimo   = DateTime.ParseExact(emprestimocsv[2], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                emprestimoLine.DataDevolucao    = DateTime.ParseExact(emprestimocsv[3], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                emprestimoLine.StatusEmprestimo = int.Parse(emprestimocsv[4]);

                emprestimos.Add(emprestimoLine);
            }
            return(emprestimos);
        }
Example #6
0
        static EmprestimoLivro CadastradoEmprestimo(long numeroTombo, long idCliente)
        {
            DateTime dataDevolucao;
            bool     dataCorreta = false;

            do
            {
                Console.Write("Digite a data de devolução do livro (dd/mm/aaaa): ");
                string dDevolucao = Console.ReadLine();

                if (!DateTime.TryParseExact(dDevolucao, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dataDevolucao))
                {
                    Console.WriteLine("\nDigite novamente a data no formato dd/mm/aaaa");
                }
                else
                {
                    if (dataDevolucao < DateTime.Today)
                    {
                        Console.WriteLine("\nData de devolução anterior ao hoje, digite uma data futura...");
                    }
                    else
                    {
                        dataCorreta = true;
                    }
                }
            } while (!dataCorreta);

            EmprestimoLivro emprestimo = new EmprestimoLivro
            {
                NumeroTombo      = numeroTombo,
                IdCliente        = idCliente,
                DataEmprestimo   = DateTime.Now,
                DataDevolucao    = dataDevolucao,
                StatusEmprestimo = 1
            };

            return(emprestimo);
        }
        public object Post(EmprestimoLivro obj)
        {
            EmprestimoLivroValidator validations = new EmprestimoLivroValidator();

            validations.RuleFor(c => c).Must(c => !emprestimoLivroService.UsuarioAtingiuLimiteEmprestimo(c.UsuarioId))
            .WithMessage("Usuário atingiu o limite de livros emprestados");

            validations.RuleFor(c => c).Must(c => !livroService.LivroPodeSerEmprestado(c.LivroId))
            .WithMessage("Livro não pode ser emprestado, pois já foi emprestado a outra pessoa");

            validations.RuleFor(c => c).Must(c => !emprestimoLivroService.UsuarioEstaBloqueado(c.UsuarioId))
            .WithMessage("O Usuário está bloqueado e não poderá fazer novos emprestimos até que 30 dias se passe da sua ultima devolução");

            var results = validations.Validate(obj);

            results.AddToModelState(ModelState, null);

            if (!ModelState.IsValid)
            {
                return(BadRequest(results.Errors));
            }
            return(emprestimoLivroService.Insert(obj));
        }
Example #8
0
 public Task <EmprestimoLivro> Insert(EmprestimoLivro obj)
 {
     return(repositoryLivroEmprestimo.Insert(obj));
 }
Example #9
0
 public Task Habilitar(EmprestimoLivro obj)
 {
     return(repositoryLivroEmprestimo.Habilitar(obj));
 }
Example #10
0
        static void Main(string[] args)
        {
            string op;

            ArquivoCliente    arquivoCliente    = new ArquivoCliente();
            ArquivoEmprestimo arquivoEmprestimo = new ArquivoEmprestimo();
            ArquivoLivro      arquivoLivro      = new ArquivoLivro();

            List <Cliente>         clientes    = new List <Cliente>();
            List <Livro>           livros      = new List <Livro>();
            List <EmprestimoLivro> emprestimos = new List <EmprestimoLivro>();

            #region Criar Arquivos

            if (!ArquivoCSV.CriarDiretorio())
            {
                if (!arquivoCliente.CriarArquivo())
                {
                    clientes = arquivoCliente.Leitura();
                }
                if (!arquivoLivro.CriarArquivo())
                {
                    livros = arquivoLivro.Leitura();
                }
                if (!arquivoEmprestimo.CriarArquivo())
                {
                    emprestimos = arquivoEmprestimo.Leitura();
                }
            }
            else
            {
                arquivoCliente.CriarArquivo();
                arquivoEmprestimo.CriarArquivo();
                arquivoLivro.CriarArquivo();
            }

            #endregion

            Console.WriteLine("Bem vindo a livraria 5by5\n");

            #region Menu

            do //Repita enquanto a opção de sair não seja escolhida
            {
                Menu();
                Console.Write(">>> ");
                op = Console.ReadLine();
                string cpf;
                long   numeroTombo;
                string nTombo;
                bool   funcionar;

                Livro           livro      = new Livro();
                Cliente         cliente    = new Cliente();;
                EmprestimoLivro emprestimo = new EmprestimoLivro();;

                switch (op)
                {
                case "1":
                    #region Cadastro Cliente

                    //Cadastro do Cliente

                    Console.Clear();
                    Console.WriteLine(">>> Cadastro de clientes <<<");

                    cliente = new Cliente();

                    Console.Write("Digite o CPF do cliente: ");
                    cpf = Console.ReadLine();

                    cliente = clientes.Find(c => c.CPF == cpf);

                    if (cliente != null)
                    {
                        //trazendo informações do cliente
                        Console.WriteLine("\nCliente já cadastrado!");
                        Console.WriteLine(cliente);
                    }
                    else
                    {
                        cliente          = CadastroCliente(cpf);
                        cliente.endereco = CadastroEndereco();
                        if (!(clientes.Count > 0))
                        {
                            cliente.IdCliente = 1;
                        }
                        else
                        {
                            cliente.IdCliente = clientes.Last().IdCliente + 1;
                        }
                        arquivoCliente.Salvar(cliente);
                        clientes.Add(cliente);

                        Console.WriteLine("Cliente cadastrado...");
                    }
                    Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                    Console.ReadKey();
                    Console.Clear();

                    break;

                    #endregion

                case "2":
                    #region Cadastro do livro

                    //Cadastro do livro

                    Console.Clear();
                    Console.WriteLine(">>> Cadastro de livros <<<");

                    Console.Write("\nDigite o ISBN do livro: ");
                    string isbn = Console.ReadLine();

                    livro = livros.Find(l => l.ISBN == isbn);

                    if (livro != null)     // se estiver cadastrado
                    {
                        Console.WriteLine("\nLivro já cadastrado!");
                        Console.WriteLine(livro);
                        Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                        Console.ReadKey();
                        Console.Clear();
                    }
                    else     //se não estiver cadastrado
                    {
                        if (!(livros.Count > 0))
                        {
                            numeroTombo = 1;
                        }
                        else
                        {
                            numeroTombo = livros.Last().NumeroTombo + 1;
                        }

                        livro = CadastroLivro(numeroTombo, isbn);
                        arquivoLivro.Salvar(livro);
                        livros.Add(livro);


                        Console.WriteLine("\nLivro cadastrado...");
                        Console.WriteLine($"O numero do tombo é: {numeroTombo}");
                        Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                        Console.ReadKey();
                        Console.Clear();
                    }
                    break;

                    #endregion

                case "3":
                    #region Empréstimo de Livro

                    //Empréstimo de Livro
                    Console.Clear();
                    Console.WriteLine(">>> Empréstimo de livros <<<");
                    if (!(livros.Count > 0))
                    {
                        Console.WriteLine("\nNenhum livro cadastrado");
                    }
                    else
                    {
                        do
                        {
                            funcionar = false;
                            do
                            {
                                Console.Write("Digite o numero do tombo: ");
                                nTombo = Console.ReadLine();

                                if (!long.TryParse(nTombo, out numeroTombo))
                                {
                                    Console.WriteLine("Digite um número inteiro !\n");
                                }
                                else
                                {
                                    funcionar = true;
                                }
                            } while (!funcionar);

                            livro = livros.Find(l => l.NumeroTombo == numeroTombo);

                            if (livro == null)
                            {
                                Console.WriteLine("\nLivro indisponível para empréstimo");
                                Console.WriteLine("Deseja tentar novamente? ");

                                op = Confirmacao();
                            }
                            else
                            {
                                do
                                {
                                    Console.Write("Digite o CPF do cliente: ");
                                    cpf     = Console.ReadLine();
                                    cliente = clientes.Find(c => c.CPF == cpf);
                                    if (cliente == null)
                                    {
                                        Console.WriteLine("\nCliente não cadastrado");
                                        Console.WriteLine("Deseja tentar novamente? ");

                                        op = Confirmacao();
                                    }
                                    else
                                    {
                                        emprestimo = CadastradoEmprestimo(numeroTombo, cliente.IdCliente);
                                        arquivoEmprestimo.Salvar(emprestimo);
                                        emprestimos.Add(emprestimo);

                                        Console.WriteLine("\nEmprestimo cadastrado...");
                                        op = "sair";     // condição para sair do laço
                                    }
                                } while (op != "sair");
                            }
                        } while (op != "sair");
                    }

                    Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                    Console.ReadKey();
                    Console.Clear();

                    break;

                    #endregion

                case "4":
                    #region Devolução do Livro

                    //Devolução do Livro

                    Console.Clear();
                    Console.WriteLine(">>> Devolução de livros <<<");

                    if (!(emprestimos.Count > 0))
                    {
                        Console.WriteLine("\nNenhum livro cadastrado para emprestimo");
                    }
                    else
                    {
                        funcionar = false;
                        do
                        {
                            Console.Write("Digite o numero do tombo: ");
                            nTombo = Console.ReadLine();

                            if (!long.TryParse(nTombo, out numeroTombo))
                            {
                                Console.WriteLine("Digite um número inteiro !\n");
                            }
                            else
                            {
                                funcionar = true;
                            }
                        } while (!funcionar);

                        int index = arquivoEmprestimo.ProcuraNumeroTombo(numeroTombo);

                        if (index == -1)     //ProcuraNumeroTombo retorna -1 caso não encontre o index
                        {
                            Console.WriteLine("\nLivro não encontrado para devolução");
                        }
                        else
                        {
                            double multa = EmprestimoLivro.CalculaMulta(emprestimos.ElementAt(index));
                            if (multa > 0)
                            {
                                Console.WriteLine($"\nMulta a ser paga: R$ {multa:F2}");
                                string resposta;
                                do
                                {
                                    Console.Write("A multa foi paga sim ou não(s/n)? ");
                                    resposta = Console.ReadLine().ToLower();
                                    if (resposta == "s")
                                    {
                                        emprestimos.ElementAt(index).StatusEmprestimo = 2;
                                        arquivoEmprestimo.Devolucao(index);
                                        //alterar situação
                                        Console.WriteLine("\nSituação alterada para \"Devolvido\"...");
                                    }
                                    else if (resposta != "n")
                                    {
                                        Console.WriteLine("Digite \"s\" ou \"n\"");
                                    }
                                    else
                                    {
                                        Console.WriteLine("\nSituação não foi alterada...");
                                    }
                                } while (resposta != "s" && resposta != "n");
                            }
                            else
                            {
                                Console.WriteLine("\nO prazo da devolução foi cumprido\n");

                                emprestimos.ElementAt(index).StatusEmprestimo = 2;
                                arquivoEmprestimo.Devolucao(index);
                                //alterar situação
                                Console.WriteLine("salvando situação para \"Devolvido\"...");
                            }

                            //Alterar para devolvido (2) no arquivoEmprestimo
                        }
                    }

                    Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                    Console.ReadKey();
                    Console.Clear();

                    break;

                    #endregion

                case "5":
                    #region Relatório de Emprestimos e Devoluções
                    Console.Clear();
                    Console.WriteLine(">>> Relatório de Emprestimos e Devoluções <<<");
                    int j = 0;
                    do
                    {
                        if (emprestimos.Count == 0)
                        {
                            Console.WriteLine("\nNenhum emprestimo cadastrado!");
                            j = -1;
                        }
                        else
                        {
                            Relatorio relatorio = new Relatorio();

                            Console.Write("\n" + relatorio.Imprimir(clientes, livros, emprestimos[j]));

                            j = relatorio.Menu(emprestimos, j);
                        }
                    } while (j != -1);

                    Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                    Console.ReadKey();
                    Console.Clear();

                    break;

                    #endregion

                case "0":
                    #region Finalizar o Programa

                    //Finalizar o Programa

                    Console.Clear();

                    do     //Repita enquanto a resposta for diferente de sim ou não
                    {
                        Console.WriteLine("\nDeseja realmente sair?");
                        Console.WriteLine("Digite \"s\" pra sim ou \"n\" para não\n");
                        Console.Write(">>> ");
                        op = Console.ReadLine().ToLower();

                        if (op == "s")
                        {
                            op = "0";
                            Console.Write("\nObrigado por usar o sistema Livraria 5by5\n");
                        }
                        else if ((op == "n"))
                        {
                            Console.Write("Pressione qualquer tecla para voltar ao menu principal...");
                            Console.ReadKey();
                            Console.Clear();
                        }
                        else
                        {
                            Console.WriteLine("Digito inválido");
                        }
                    } while (op != "0" && op != "n");

                    break;

                    #endregion

                default:
                    Console.Clear();
                    Console.WriteLine("\nPor favor digite uma opção do menu !\n");
                    break;
                }
            } while (op != "0");

            #endregion

            Console.Write("Pressione qualquer tecla para encerrar...");
            Console.ReadKey();
        }
Example #11
0
        //Devolução
        public static void Devolucao(List <EmprestimoLivro> listaEmprestimo, List <StatusEmprestimo> listaStatus, List <Cliente> listaClient)
        {
            long     numeroTombo;
            int      encontradoNumeroTombo = 0;
            string   cpf        = "";
            long     id         = 0;
            DateTime datual     = DateTime.Now;
            DateTime ddevolucao = DateTime.Now;
            TimeSpan result;
            double   multa;

            /*foreach (var elemento in listaEmprestimo)
             * {
             *      Console.WriteLine(elemento.ToString());
             * }*/

            numeroTombo = LeiaNumeroTombo();



            foreach (var elemento in listaEmprestimo)
            {
                if (elemento.StatusEmprestimo == 2)
                {
                    break;
                }
                else if (elemento.NumeroTombo == numeroTombo)
                {
                    encontradoNumeroTombo++;
                    ddevolucao = elemento.DataDevolucao;
                }
            }
            if (encontradoNumeroTombo == 0)
            {
                Console.WriteLine("Livro não encontrado para devolução");
            }
            else
            {
                result = datual - ddevolucao;


                if (result.Days > 0)
                {
                    multa = (result.Days * 0.10);

                    Console.WriteLine("O valor da Multa é  R$:" + multa.ToString("N2"));
                    for (int i = 0; i < listaEmprestimo.Count; i++)
                    {
                        if (listaEmprestimo[i].NumeroTombo == numeroTombo)
                        {
                            EmprestimoLivro el = new EmprestimoLivro();
                            el.IdCliente        = listaEmprestimo[i].IdCliente;
                            el.NumeroTombo      = listaEmprestimo[i].NumeroTombo;
                            el.DataEmprestimo   = listaEmprestimo[i].DataEmprestimo;
                            el.DataDevolucao    = listaEmprestimo[i].DataDevolucao;
                            el.StatusEmprestimo = 2;
                            listaEmprestimo[i]  = el;
                            EscreverArquivo(listaEmprestimo);
                            id = el.IdCliente;
                        }
                    }
                    for (int i = 0; i < listaClient.Count; i++)
                    {
                        if (listaClient[i].IdCliente == id)
                        {
                            cpf = listaClient[i].Cpf;
                        }
                    }

                    for (int i = 0; i < listaStatus.Count; i++)
                    {
                        if (listaStatus[i].Cpf == cpf)
                        {
                            StatusEmprestimo se = new StatusEmprestimo();
                            se.Cpf            = listaStatus[i].Cpf;
                            se.Titulo         = listaStatus[i].Titulo;
                            se.DataEmprestimo = listaStatus[i].DataEmprestimo;
                            se.DataDevolucao  = listaStatus[i].DataDevolucao;
                            se.Status         = 2;
                            listaStatus[i]    = se;
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Não há multa a se pagar");
                    for (int i = 0; i < listaEmprestimo.Count; i++)
                    {
                        if (listaEmprestimo[i].NumeroTombo == numeroTombo)
                        {
                            EmprestimoLivro el = new EmprestimoLivro();
                            el.IdCliente        = listaEmprestimo[i].IdCliente;
                            el.NumeroTombo      = listaEmprestimo[i].NumeroTombo;
                            el.DataEmprestimo   = listaEmprestimo[i].DataEmprestimo;
                            el.DataDevolucao    = listaEmprestimo[i].DataDevolucao;
                            el.StatusEmprestimo = 2;
                            listaEmprestimo[i]  = el;
                            EscreverArquivo(listaEmprestimo);
                            id = el.IdCliente;
                        }
                    }
                    for (int i = 0; i < listaClient.Count; i++)
                    {
                        if (listaClient[i].IdCliente == id)
                        {
                            cpf = listaClient[i].Cpf;
                        }
                    }

                    for (int i = 0; i < listaStatus.Count; i++)
                    {
                        if (listaStatus[i].Cpf == cpf)
                        {
                            StatusEmprestimo se = new StatusEmprestimo();
                            se.Cpf            = listaStatus[i].Cpf;
                            se.Titulo         = listaStatus[i].Titulo;
                            se.DataEmprestimo = listaStatus[i].DataEmprestimo;
                            se.DataDevolucao  = listaStatus[i].DataDevolucao;
                            se.Status         = 2;
                            listaStatus[i]    = se;
                        }
                    }
                }
                Console.WriteLine("Aperte qualquer tecla para retorar ao menu principal");
                Console.ReadKey();
            }
        }
Example #12
0
 // RETORNA EMPRESTIMO NO FORMATO PARA ARQUIVO
 private static string FormatoParaArquivo(EmprestimoLivro e)
 {
     return(e.IdCliente.ToString().PadRight(5, ' ') + ";" + e.NumeroTombo.ToString().PadRight(5, ' ') + ";" +
            e.DataEmprestimo.ToString("dd/MM/yyyy") + ";" + e.DataDevolucao.ToString("dd/MM/yyyy") + ";" + e.StatusEmprestimo);
 }
Example #13
0
        public static void Registrar(List <EmprestimoLivro> listaEmprestimo, List <Livro> listaLivro, List <Cliente> listaCliente, List <StatusEmprestimo> listaStatus)
        {
            // VARIAVEIS
            string   cpf;
            long     idcliente = 0, numeroTombo;
            DateTime demprestimo, ddevolucao;
            int      status                = 0;
            int      statusfim             = 0;
            int      encontradoNumeroTombo = 0;
            int      encontradoCpf         = 0;
            string   nomelivro             = "";
            string   cpfstatus             = "";

            do
            {
                numeroTombo = LeiaNumeroTombo();


                foreach (var elemento in listaEmprestimo)
                {
                    if (elemento.NumeroTombo == numeroTombo && elemento.StatusEmprestimo == 1)
                    {
                        Console.WriteLine("Livro emprestado, aguarde a sua devolução");
                        statusfim = 1;
                    }
                }


                if (statusfim != 1)
                {
                    foreach (var elemento in listaLivro)
                    {
                        if (elemento.NumeroTombo == numeroTombo)
                        {
                            encontradoNumeroTombo++;
                            nomelivro = elemento.Titulo;
                        }
                    }
                    if (encontradoNumeroTombo == 0)
                    {
                        Console.WriteLine("Livro não está disponivel para emprestimo");
                    }
                    else
                    {
                        cpf = LerCpf();

                        foreach (var elemento in listaCliente)
                        {
                            if (elemento.Cpf.ToString() == cpf)
                            {
                                idcliente = elemento.IdCliente;
                                encontradoCpf++;
                                cpfstatus = elemento.Cpf;
                            }
                        }
                        if (encontradoCpf == 0)
                        {
                            Console.WriteLine("Cliente não cadastrado");
                        }
                        else
                        {
                            demprestimo = DateTime.Now;
                            Console.Write("Data do Emprestimo: " + demprestimo + "\n");

                            ddevolucao = LeiaDevolucao();

                            status = 1;



                            StatusEmprestimo novoStatus = new StatusEmprestimo()
                            {
                                Cpf            = cpfstatus,
                                Titulo         = nomelivro,
                                Status         = status,
                                DataEmprestimo = demprestimo,
                                DataDevolucao  = ddevolucao
                            };


                            EmprestimoLivro novoEmprestimo = new EmprestimoLivro()
                            {
                                IdCliente        = idcliente,
                                NumeroTombo      = numeroTombo,
                                DataEmprestimo   = demprestimo,
                                DataDevolucao    = ddevolucao,
                                StatusEmprestimo = status
                            };

                            listaStatus.Add(novoStatus);
                            listaEmprestimo.Add(novoEmprestimo);
                            listaEmprestimo = listaEmprestimo.OrderBy(x => x.IdCliente).ToList();
                            listaStatus     = listaStatus.OrderBy(x => x.Cpf).ToList();
                            EscreverArquivo(listaEmprestimo);
                            Console.Clear();
                            Console.WriteLine("Emprestimo Cadastrado");
                            Console.WriteLine("Aperte qualquer tecla para voltar ao menu principal");
                            Console.ReadKey();
                            Console.Clear();
                        }
                    }
                }
            } while (encontradoCpf == 0 && statusfim != 1);
        }