示例#1
0
        public async Task <IActionResult> Editar(int id)
        {
            try
            {
                var emprestimoViewModel = await GetForm(await _emprestimoService.GetById(id));

                return(View(emprestimoViewModel));
            }
            catch (Exception)
            {
                TratarErro();
            }

            return(View());
        }
示例#2
0
        public async Task DeveAtualizarEmprestimo()
        {
            var emprestimo = await _emprestimoService.GetById(6);

            emprestimo.DataDevolucao = emprestimo.DataDevolucao.AddDays(-110);

            var livro = await _livroService.FindByTitulo(new LivroPesquisa("A Torre Negra", 0), new PaginacaoParametroDto());

            livro.ToList().ForEach(c => c.Disponivel = false);

            emprestimo.AdicionarLivroEmprestimo(emprestimo.Cliente, livro);

            await _emprestimoService.Save(emprestimo);

            var result = await _unitOfWork.Commit();

            Assert.NotEqual(0, result);
        }