public IActionResult Edicao(int id)
        {
            LivroService      livroService = new LivroService();
            EmprestimoService em           = new EmprestimoService();
            Emprestimo        e            = em.ObterPorId(id);

            CadEmprestimoViewModel cadModel = new CadEmprestimoViewModel();

            cadModel.Livros     = livroService.ListarTodos();
            cadModel.Emprestimo = e;

            return(View(cadModel));
        }
        public IActionResult Edicao(int id)
        {
            Autenticacao.CheckLogin(this);
            LivroService      livroService = new LivroService();
            EmprestimoService em           = new EmprestimoService();
            Emprestimo        e            = em.ObterPorId(id);

            CadEmprestimoViewModel cadModel = new CadEmprestimoViewModel();

            cadModel.Emprestimo = e;
            cadModel.Livros     = livroService.ListarDisponiveis(e);

            return(View(cadModel));
        }
Example #3
0
        public IActionResult Edicao(int id)
        {
            Autenticacao.CheckLogin(this);
            LivroService      LivroService = new LivroService();
            EmprestimoService em           = new EmprestimoService();
            Emprestimo        e            = em.ObterPorId(id);

            CadEmprestimoViewModel cadModel = new CadEmprestimoViewModel();

            cadModel.Livros = LivroService.ListarTodos();
            cadModel.Livros.Add(LivroService.ObterPorId(e.LivroId));
            cadModel.Emprestimo = e;

            return(View(cadModel));
        }