// GET: Prestamos/Edit/5 public ActionResult Edit(int?id) { //PrestamoViewModel prestamoViewModel = new PrestamoViewModel(); PrestamosService prestamosServ = new PrestamosService(); Prestamo pModel = _db.Prestamos.Find(id); Cliente cliente = _db.Clientes.Find(pModel.ClienteId); var status = (pModel.Estatus == true) ? PrestamoViewModel.estatus.Activo : PrestamoViewModel.estatus.Inactivo; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PrestamoViewModel prestamoViewModel = new PrestamoViewModel { Id = pModel.Id, Cliente = cliente.Nombre, Clientes = prestamosServ.ObtenerListaClientes(), Monto = pModel.Monto, Fecha = pModel.Fecha, Status = status }; //prestamoViewModel = prestamosServ.ObtenerPrestamo(id); if (prestamoViewModel == null) { return(HttpNotFound()); } return(View(prestamoViewModel)); }
// GET: Prestamos/Create public ActionResult Create() { PrestamoViewModel model = new PrestamoViewModel(); PrestamosService prestamosServ = new PrestamosService(); #region Porpular DropDownList con nombres de clientes model.Clientes = prestamosServ.ObtenerListaClientes(); #endregion return(View(model)); }