Exemplo n.º 1
0
 private void FinalizarSituacaoEmprestimo(Emprestimo emprestimo)
 {
     emprestimo.DataDevolucao = DateTime.Now;
     emprestimo.IsAtivo       = false;
     emprestimo.IsEmprestado  = false;
     _emprestimoService.Atualizar(emprestimo);
 }
Exemplo n.º 2
0
        public EmprestimoViewModel Atualizar(EmprestimoViewModel obj)
        {
            var mappedModel = Mapper.Map <EmprestimoViewModel, Emprestimo>(obj);

            var updateModel = _service.Atualizar(mappedModel);

            return(Mapper.Map <Emprestimo, EmprestimoViewModel>(updateModel));
        }
        public async Task <IActionResult> Edit(Guid id, EmprestimoViewModel emprestimoViewModel)
        {
            if (id != emprestimoViewModel.Id)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(View(emprestimoViewModel));
            }

            var emprestimo = _mapper.Map <Emprestimo>(emprestimoViewModel);
            await _emprestimoService.Atualizar(emprestimo);

            if (!OperacaoValida())
            {
                return(View(await ObterEmprestimoJogoAmigo(id)));
            }

            return(RedirectToAction("Index"));
        }