Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdReserva,IdConductor,IdAfiliado,Fecha")] Reserva reserva)
        {
            if (id != reserva.IdReserva)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reserva);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReservaExists(reserva.IdReserva))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdAfiliado"]  = new SelectList(_context.Afiliado, "IdAfiliado", "IdAfiliado", reserva.IdAfiliado);
            ViewData["IdConductor"] = new SelectList(_context.Conductor, "IdConductor", "Apellido", reserva.IdConductor);
            return(View(reserva));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdAfiliado,Correo,Descripcion")] Afiliado afiliado)
        {
            if (id != afiliado.IdAfiliado)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(afiliado);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AfiliadoExists(afiliado.IdAfiliado))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(afiliado));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("VehiculoId,ConductorId,Placa,Modelo,Categoria")] Vehiculo vehiculo)
        {
            if (id != vehiculo.VehiculoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehiculo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehiculoExists(vehiculo.VehiculoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ConductorId"] = new SelectList(_context.Conductor, "ConductorId", "Nombres", vehiculo.ConductorId);
            return(View(vehiculo));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("EmpresaId,Nombre,Ruc,Direccion")] Empresa empresa)
        {
            if (id != empresa.EmpresaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(empresa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmpresaExists(empresa.EmpresaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(empresa));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ReservaId,VehiculoId,EmpresaId,Fecha,Observaciones")] Reserva reserva)
        {
            if (id != reserva.ReservaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reserva);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReservaExists(reserva.ReservaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpresaId"]  = new SelectList(_context.Empresa, "EmpresaId", "Nombre", reserva.EmpresaId);
            ViewData["VehiculoId"] = new SelectList(_context.Vehiculo, "VehiculoId", "Placa", reserva.VehiculoId);
            return(View(reserva));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ConductorId,Usuario,Nombres,Apellidos,Dni,Correo,Celular")] Conductor conductor)
        {
            if (id != conductor.ConductorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(conductor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConductorExists(conductor.ConductorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(conductor));
        }