public IActionResult Edit(int id, Viaje viaje) { if (id != viaje.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _service.Update(viaje); _service.Save(); } catch (DbUpdateConcurrencyException) { if (!ViajeExists(viaje.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(viaje)); }
public ActionResult Update(Viaje viaje) { try { _viajeService.Update(viaje); } catch (Exception) { return(new JsonResult("Oops! algo salio mal.") { StatusCode = 400 }); } return(new JsonResult("OK") { StatusCode = 200 }); }