public ActionResult Details(int id) { Aluguel aluguel = _aluguelService.Buscar(id); AluguelModel aluguelModel = _mapper.Map <AluguelModel>(aluguel); return(View(aluguelModel)); }
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); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } try { Aluguel aluguel = service.Buscar(id); ReservaAluguelViewModel aluguelVM = Mapper.Map <Aluguel, ReservaAluguelViewModel>(aluguel); return(View(aluguelVM)); } catch (BusinessException ex) { return(HttpNotFound(ex.Message)); } }