Example #1
0
 public ActionResult Eliminar(Pago pago)
 {
     try
     {
         repositorio.Baja(pago.IdPago);
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error     = ex.Message;
         ViewBag.StackTrae = ex.StackTrace;
         return(View());
     }
 }
Example #2
0
 public ActionResult Eliminar(int id, Propietario entidad)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Mensaje"] = "Propietario eliminado correctamente";
         return(RedirectToAction("Listado"));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View(entidad));
     }
 }
Example #3
0
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Mensaje"] = "Se eliminó el inquilino correctamente";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View(collection));
     }
 }
 public ActionResult Delete(int id, Pago entidad)
 {
     try
     {
         repoPago.Baja(id);
         TempData["Alta"] = "Pago eliminado";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View());
     }
 }
Example #5
0
 public ActionResult Delete(int id, Inquilino inquilino)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Id"] = "El Inquilino ha sido eliminado";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = "Inquilino con alquiler vigente";
         ViewBag.StackTrate = ex.StackTrace;
         return(View());
     }
 }
Example #6
0
 public ActionResult Delete(int id, Propietario entidad)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Alta"] = "Propietario eliminado";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = "Propietario dispone de inmuebles";
         ViewBag.StackTrate = ex.StackTrace;
         return(View(entidad));
     }
 }
Example #7
0
 public ActionResult Delete(int id, Alquiler entidad)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Id"] = "Se eliminó correctamente";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = "Hay pagos relacionados a este alquiler";
         ViewBag.StackTrate = ex.StackTrace;
         return(View());
     }
 }
Example #8
0
 public ActionResult Delete(int id, Alquiler miAlquiler)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Mensaje"] = "Eliminación realizada correctamente";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View(miAlquiler));
     }
 }
 public ActionResult Delete(int id, Inquilino i)
 {
     try
     {
         // TODO: Add delete logic here
         ri.Baja(id);
         TempData["Mensaje"] = "Eliminación realizada correctamente";
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View(i));
     }
 }
Example #10
0
        public ActionResult Delete(int id, IFormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                var inquilino = repositorio.ObtenerPorId(id);

                repositorio.Baja(inquilino.InquilinoId);


                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult Delete(int id, Pago collection)
 {
     try {
         repositorio.Baja(id);
         TempData["Id"] = "eliminó el pago";
         return(RedirectToAction(nameof(Index), new { id = collection.IdAlquiler }));
     } catch (Exception ex) {
         if (ex.Message.StartsWith("The DELETE statement conflicted with the REFERENCE"))
         {
             ViewBag.Error = "No se puede eliminar el pago ya que tiene contratos a su nombre";
         }
         else
         {
             ViewBag.Error      = ex.Message;
             ViewBag.StackTrate = ex.StackTrace;
         }
         return(View(collection));
     }
 }
 public ActionResult Borrar(int id, IFormCollection collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             repo.Baja(id);
             TempData["MensajeData"] = "Se Borro el propietario con exito";
             return(RedirectToAction(nameof(Index)));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception e)
     {
         return(View());
     }
 }
 public ActionResult Delete(int id, Inmueble collection)
 {
     try {
         repositorio.Baja(id);
         TempData["Id"] = "eliminó el inmueble";
         return(RedirectToAction(nameof(Index)));
     } catch (Exception ex) {
         if (ex.Message.StartsWith("The DELETE statement conflicted with the REFERENCE"))
         {
             var uno = repositorio.ObtenerPorId(id);
             ViewBag.lugar = uno.Propietario.Nombre + " " + uno.Propietario.Apellido + " en " + uno.Direccion;
             ViewBag.Error = "No se puede eliminar el inmueble ya que tiene contratos a su nombre";
         }
         else
         {
             ViewBag.Error      = ex.Message;
             ViewBag.StackTrate = ex.StackTrace;
         }
         return(View(collection));
     }
 }
Example #14
0
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             repositorio.Baja(id);
             ViewBag.Mensaje = "Se borro con exito el alquiler";
             return(View());
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View());
     }
 }
Example #15
0
 public ActionResult Delete(int id, Alquiler collection)
 {
     try {
         repositorio.Baja(id);
         Inmuebles.ActualizarDisponible(collection.IdInmueble, 1);
         TempData["Id"] = "eliminó el alquiler";
         return(RedirectToAction(nameof(Index)));
     } catch (Exception ex) {
         if (ex.Message.StartsWith("The DELETE statement conflicted with the REFERENCE"))
         {
             ViewBag.Error = "No se puede eliminar el alquiler ya que tiene pagos a su nombre";
         }
         else
         {
             ViewBag.Error      = ex.Message;
             ViewBag.StackTrate = ex.StackTrace;
         }
         var uno = repositorio.ObtenerPorId(id);
         ViewBag.trato = " el locador " + uno.Inmueble.Propietario.Nombre + " " + uno.Inmueble.Propietario.Apellido + " y el locatario " + uno.Inquilino.Nombre + " " + uno.Inquilino.Apellido + " para el inmueble con dirección en " + uno.Inmueble.Direccion;
         return(View(collection));
     }
 }
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         if (ModelState.IsValid)
         {
             repo.Baja(id);
             TempData["MensajeData"] = "Se Borro el inquilino con exito";
             return(RedirectToAction(nameof(Index)));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception e)
     {
         ViewBag.StackTrace = e.StackTrace;
         ViewBag.Error      = e.Message;
         return(View());
     }
 }
 public ActionResult Delete(int id, Inquilino ent)
 {
     try
     {
         repositorio.Baja(id);
         TempData["Mensaje"] = "Inquilino eliminado con éxito!";
         return(RedirectToAction(nameof(Index)));
     }
     catch (SqlException e)
     {
         if (e.Number == 547)
         {
             TempData["Error"] = "No se pudo eliminar, está en uso.";
         }
         return(RedirectToAction(nameof(Index)));;
     }
     catch (Exception)
     {
         TempData["Error"] = "Ocurrió un error inesperado.";
         return(RedirectToAction(nameof(Index)));;
     }
 }
Example #18
0
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         var res = repo.Baja(id);
         if (res != -1)
         {
             return(RedirectToAction(nameof(Index)));
         }
         else
         {
             TempData["Error"] = "No se pudo eliminar el inquilino";
             return(View());
         }
     }
     catch (Exception ex)
     {
         ViewBag.Error      = ex.Message;
         ViewBag.StackTrate = ex.StackTrace;
         return(View());
     }
 }