public void EmprestimoRepositorio_Salvar_ShouldBeOk() { Emprestimo emprestimo = ObjectMotherEmprestimo.GetEmprestimo(); emprestimo.Livro = _livro; Emprestimo result = _service.Adicionar(emprestimo); result.Id.Should().BeGreaterThan(0); }
public EmprestimoViewModel Adicionar(EmprestimoViewModel obj) { var mappedModel = Mapper.Map <EmprestimoViewModel, Emprestimo>(obj); var addedModel = _service.Adicionar(mappedModel); return(Mapper.Map <Emprestimo, EmprestimoViewModel>(addedModel)); }
public async Task <IActionResult> Create(EmprestimoViewModel emprestimoViewModel) { emprestimoViewModel = await PopularJogos(emprestimoViewModel); if (!ModelState.IsValid) { return(CustomResponse(ModelState)); } await _emprestimoService.Adicionar(_mapper.Map <Emprestimo>(emprestimoViewModel)); return(RedirectToAction("Index")); }