Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 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
     });
 }