public ActionResult Create(AluguelModel aluguelModel) { if (ModelState.IsValid) { var aluguel = _mapper.Map <Aluguel>(aluguelModel); _aluguelService.Inserir(aluguel); } return(RedirectToAction(nameof(Index))); }
public void InserirTest() { // Act _aluguelService.Inserir(new Aluguel { CodigoAluguel = 4, Descricao = "Aluguel novo", CodigoStatusPagamento = 1 }); // Assert Assert.AreEqual(4, _aluguelService.ObterTodos().Count()); var aluguel = _aluguelService.Buscar(4); Assert.AreEqual("Aluguel novo", aluguel.Descricao); Assert.AreEqual(1, aluguel.CodigoStatusPagamento); }