public ActionResult Create(int id, Pago pago) { try { repositorio.Alta(pago); TempData["Id"] = "efectuó el pago"; return(RedirectToAction(nameof(Index), new { id = id })); } catch (Exception ex) { ViewBag.alquileres = Alquileres.ObtenerPorId(id); ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View(pago)); } }
public ActionResult Create(Alquiler alquiler) { try { repositorio.Alta(alquiler); Inmuebles.ActualizarDisponible(alquiler.IdInmueble, 0); TempData["Id"] = "creó el alquiler"; return(RedirectToAction(nameof(Index))); } catch (Exception ex) { ViewBag.propis = Inmuebles.ObtenerTodos(); ViewBag.inquis = Inquilinos.ObtenerTodos(); ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View(alquiler)); } }
public ActionResult Create(Pago pago) { try { repoPago.Alta(pago); TempData["Alta"] = "Se creó correctamente"; return(RedirectToAction(nameof(Index))); } catch (Exception ex) { ViewBag.pago = repoPago.ObtenerTodos(); ViewBag.alquiler = repoAlquiler.ObtenerTodos(); ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View()); } }
public ActionResult Create(Pago pago) { try { repoPago.Alta(pago); TempData["Id"] = "Nuevo pago ingresado"; return(RedirectToAction(nameof(Index))); } catch (Exception ex) { ViewBag.pago = repoPago.ObtenerTodos(); ViewBag.alquiler = repoAlquiler.ObtenerTodos(); ViewBag.Error = "Contrato de alquiler inexistente"; ViewBag.StackTrate = ex.StackTrace; return(View()); } }
public ActionResult Create(Inquilino inquilino) { try { inquilinos.Alta(inquilino); TempData["Id"] = inquilino.Id; return(RedirectToAction(nameof(Index))); } catch (Exception e) { ViewBag.Error = e.Message; return(View()); } }
public ActionResult Create(Inquilino inquilino) { try { TempData["Nombre"] = inquilino.Nombre; //if (ModelState.IsValid) //{ repositorio.Alta(inquilino); return(RedirectToAction(nameof(Index))); //} //else // return View(); } catch { return(View()); } }
public ActionResult Create(Inquilino ent) { try { int res = repositorio.Alta(ent); TempData["Mensaje"] = $"Inquilino creado con éxito! Id: {res}"; return(RedirectToAction(nameof(Index))); } catch (SqlException e) { TempData["Error"] = e.Number + " " + e.Message; return(View()); } catch (Exception) { TempData["Error"] = "Ocurrió un error inesperado."; return(View()); } }
public ActionResult Create(Inquilino propietario) { try { TempData["Nombre"] = propietario.Nombre; if (ModelState.IsValid) { repositorio.Alta(propietario); return(RedirectToAction(nameof(Index))); } else { return(View()); } } catch { return(View()); } }
public ActionResult Create(Propietario propietario) { ViewBag.propietarios = repositorio.ObtenerTodos(); foreach (var item in (IList <Propietario>)ViewBag.propietarios) { if (item.Email == propietario.Email || item.Dni == propietario.Dni) { ViewBag.Error2 = "Error: Ya existe un propietario con ese email o dni"; return(View()); } } try { TempData["Nombre"] = propietario.Nombre; if (ModelState.IsValid) { propietario.Clave = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: propietario.Clave, salt: System.Text.Encoding.ASCII.GetBytes("SALADA"), prf: KeyDerivationPrf.HMACSHA1, iterationCount: 1000, numBytesRequested: 256 / 8)); repositorio.Alta(propietario); TempData["Alta"] = "Propietario agregado exitosamente!"; return(RedirectToAction(nameof(Index))); } else { return(View()); } } catch (Exception ex) { ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View()); } }
public ActionResult Create(Alquiler alquiler) { try { if (ModelState.IsValid) { repositorio.Alta(alquiler); TempData["Id"] = alquiler.IdAlquiler; return(View(alquiler)); } else { return(View(alquiler)); } } catch (Exception ex) { ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View(alquiler)); } }
public ActionResult Create(Inquilino inquilino) { try { if (ModelState.IsValid) { int res = ri.Alta(inquilino); TempData["Id"] = inquilino.Id; return(RedirectToAction(nameof(Index))); } else { return(View(inquilino)); } } catch (Exception ex) { ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View(inquilino)); } }
public ActionResult Create(Propietario propietario) { try { if (ModelState.IsValid) { repo.Alta(propietario); TempData["id"] = propietario.IdPropietario; return(RedirectToAction(nameof(Index))); } else { return(View()); } } catch (Exception ex) { ViewBag.StackTrace = ex.StackTrace; ViewBag.Error = ex.Message; return(View()); } }
public ActionResult Create(Contrato contrato) { try { //Valida con las anotaciones hechas en el model Contrato if (ModelState.IsValid) { var res = repo.Alta(contrato); if (res != -1) { TempData["Id"] = contrato.IdContrato; //el Redirect hace que se pierda la info del Viewbag/Viewdata por lo que se puede utilizar el //TempData de la linea de arriba return(RedirectToAction(nameof(Index))); } else { TempData["Error"] = "El contrato no pudo darse de alta"; ViewBag.Inmuebles = repoIn.GetAll(); ViewBag.Inquilinos = repoInq.GetAll(); return(View()); } } else { ViewBag.Inmuebles = repoIn.GetAll(); ViewBag.Inquilinos = repoInq.GetAll(); return(View()); } } catch (Exception ex) { ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; ViewBag.Inmuebles = repoIn.GetAll(); ViewBag.Inquilinos = repoInq.GetAll(); return(View()); } }
public ActionResult Create(Inquilino inquilino) { try { TempData["Nombre"] = inquilino.Nombre; if (ModelState.IsValid) { repositorio.Alta(inquilino); return(RedirectToAction(nameof(Index))); } else { return(View(inquilino)); } } catch (Exception ex) { ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View(inquilino)); } }
public ActionResult Create(Alquiler alquiler) { try { if (ModelState.IsValid) { repositorio.Alta(alquiler); TempData["Id"] = alquiler.AlquilerId; return(RedirectToAction(nameof(Index))); } else { ViewBag.Alquileres = repositorio.ObtenerTodos(); return(View(alquiler)); } } catch (Exception ex) { ViewBag.Error = ex.Message; ViewBag.StackTrate = ex.StackTrace; return(View(alquiler)); } }
public ActionResult Create(Inquilino inquilino) { try { if (ModelState.IsValid) { repo.Alta(inquilino); TempData["id"] = inquilino.IdInquilino; TempData["MensajeData"] = "Se Creo 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 Create(Pago pago) { try { if (ModelState.IsValid) { repoPago.Alta(pago); TempData["id"] = pago.IdAlquiler; TempData["Mensaje"] = "Se Creo el contrato de Alquiler con exito"; return(RedirectToAction(nameof(Index))); } else { return(View()); } } catch (Exception e) { ViewBag.StackTrace = e.StackTrace; ViewBag.Error = e.Message; return(View()); } }
public ActionResult Create(Inquilino inquilino) { repositorio.Alta(inquilino); TempData["Id"] = "creó el inquilino"; return(RedirectToAction(nameof(Index))); }