public ActionResult Finalizar(int id, ProyectoMVC.Model.Prestamos elPrestamo)
        {
            try
            {
                ProyectoMVC.LogicaDeNegocios.CordinadorDePrestamos cordinadorDePrestamos = new LogicaDeNegocios.CordinadorDePrestamos();
                elPrestamo.dias            = cordinadorDePrestamos.CalcularDias(elPrestamo.fechaDeDevolucion, elPrestamo.fechaDePrestamo);
                elPrestamo.montoDePrestamo = cordinadorDePrestamos.CalcularMontoPrestamo(elPrestamo.dias);
                elPrestamo.montoACancelar  = cordinadorDePrestamos.CalcularMontoACancelar(elPrestamo.montoDePrestamo, elPrestamo.prima);
                string numeroDePlaca    = elPrestamo.placaDelVehiculo;
                string cedulaDelCliente = elPrestamo.cedulaDelCliente;
                cordinadorDePrestamos.Editar(elPrestamo);
                cordinadorDePrestamos.ColocarEnFinalizado(id);

                ProyectoMVC.LogicaDeNegocios.CordinadorDeVehiculos cordinadorDeVehiculos = new LogicaDeNegocios.CordinadorDeVehiculos();
                int idVehiculo = cordinadorDeVehiculos.ObtenerIdVehiculoPorNumeroDePlaca(numeroDePlaca);
                cordinadorDeVehiculos.ColocarEnDisponible(idVehiculo);

                ProyectoMVC.LogicaDeNegocios.CordinadorDeClientes cordinadorDeClientes = new LogicaDeNegocios.CordinadorDeClientes();
                int idCliente = cordinadorDeClientes.ObtenerIdClientePorNumeroDeCedula(cedulaDelCliente);
                cordinadorDeClientes.ColocarEnDisponible(idCliente);

                return(RedirectToAction("ListarPrestamos"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Crear(ProyectoMVC.Model.Prestamos elNuevoPrestamo)
        {
            try
            {
                ProyectoMVC.LogicaDeNegocios.CordinadorDePrestamos cordinadorDePrestamos = new LogicaDeNegocios.CordinadorDePrestamos();
                elNuevoPrestamo.dias            = cordinadorDePrestamos.CalcularDias(elNuevoPrestamo.fechaDeDevolucion, elNuevoPrestamo.fechaDePrestamo);
                elNuevoPrestamo.montoDePrestamo = cordinadorDePrestamos.CalcularMontoPrestamo(elNuevoPrestamo.dias);
                elNuevoPrestamo.montoACancelar  = cordinadorDePrestamos.CalcularMontoACancelar(elNuevoPrestamo.montoDePrestamo, elNuevoPrestamo.prima);
                cordinadorDePrestamos.Agregar(elNuevoPrestamo);

                ProyectoMVC.LogicaDeNegocios.CordinadorDeVehiculos cordinadorDeVehiculos = new LogicaDeNegocios.CordinadorDeVehiculos();
                int idVehiculo = cordinadorDeVehiculos.ObtenerIdVehiculoPorNumeroDePlaca(elNuevoPrestamo.placaDelVehiculo);
                cordinadorDeVehiculos.ColocarEnPrestamo(idVehiculo);

                ProyectoMVC.LogicaDeNegocios.CordinadorDeClientes cordinadorDeClientes = new LogicaDeNegocios.CordinadorDeClientes();
                int idCliente = cordinadorDeClientes.ObtenerIdClientePorNumeroDeCedula(elNuevoPrestamo.cedulaDelCliente);
                cordinadorDeClientes.ColocarEnPrestamo(idCliente);

                return(RedirectToAction("ListarPrestamos"));
            }
            catch
            {
                return(View());
            }
        }
 public void Agregar(ProyectoMVC.Model.Prestamos elNuevoPrestamo)
 {
     ProyectoMVC.AccesoADatos.GestorDePrestamos elGestor = new AccesoADatos.GestorDePrestamos();
     elNuevoPrestamo.estado = (byte)EstadoDePrestamo.enProceso;
     elGestor.Agregar(elNuevoPrestamo);
 }