internal void RegistrarDevolucao() { VisualizarRegistro(); if (controladorEmprestimo.VerificarVazio()) { Console.ReadLine(); return; } if (!controladorEmprestimo.VerificarSeExisteEmprestimosAtivos()) { Console.ReadLine(); return; } Console.Write("Digite o ID do emprestimo: "); int id = Convert.ToInt32(Console.ReadLine()); if (!controladorEmprestimo.IdExiste(id)) { Console.Write("Não existe esse ID "); Console.ReadLine(); return; } Emprestimo emprestimo; emprestimo = controladorEmprestimo.SelecionarEmprestimoPorId(id); emprestimo.estaAtivo = false; Console.Write("Devolvido com sucesso"); Console.ReadLine(); }
internal void RegistrarDevolucao() { Console.Clear(); MostrarEmprestimosAbertos(); Console.WriteLine("Digite a id do emprestimo que deseja registrar devolução: "); int idSelecionado; Int32.TryParse(Console.ReadLine(), out idSelecionado); int idExitente = controladorEmprestimo.VerificaId(idSelecionado); if (idExitente == 0) { Console.WriteLine("Id não encontrado, tente novamente!!"); Console.ReadLine(); } else { Emprestimo emprestimo; emprestimo = controladorEmprestimo.SelecionarEmprestimoPorId(idSelecionado); emprestimo.Status = false; emprestimo.DataDevolucao = DateTime.Now.ToLocalTime(); Console.WriteLine("Devolução registrada com sucesso!"); } }