public ActionResult Edit(int id, Hotel hotel) { try { // TODO: Add update logic here if (ModelState.IsValid) { hotelService.AlterarHotel(hotel); TempData["resultado"] = "Editado"; TempData["id"] = hotel.HotelId; TempData["nome"] = hotel.Nome; TempData["controller"] = "Hotel"; return(RedirectToAction("Index")); } else { return(View(hotel)); } } catch { TempData["resultado"] = "Erro"; return(View(hotel)); } }
public ActionResult Alterar(Hotel hotel) { if (ModelState.IsValid) { hotelService.AlterarHotel(hotel); return(RedirectToAction("Index")); } return(View(hotel)); }