示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdEmpleado,IdUsuario,IdCargo,TipoDocumento,NumDocumento,Nombre1,Nombre2,Apellido1,Apellido2,Direccion,Telefono,Email,Estado")] Empleados empleados)
        {
            if (id != empleados.IdEmpleado)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(empleados);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmpleadosExists(empleados.IdEmpleado))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCargo"]   = new SelectList(_context.Cargos, "IdCargo", "NombreCargo", empleados.IdCargo);
            ViewData["IdUsuario"] = new SelectList(_context.Usuarios, "IdUsuario", "Clave", empleados.IdUsuario);
            return(View(empleados));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Biography,CountryId")] Artist artist)
        {
            if (id != artist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(artist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArtistExists(artist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Country, "Id", "Id", artist.CountryId);
            return(View(artist));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdCargo,NombreCargo,Estado")] Cargos cargos)
        {
            if (id != cargos.IdCargo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cargos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CargosExists(cargos.IdCargo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cargos));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdProducto,IdCategoriaProducto,Codigo,NombreProducto,Descripcion,Stock,PrecioCompra,PrecioVenta,MarcaProducto,MarcaCoche,Referencia,Modelo,Lado,Ubicacion,Imagen,Estado")] Productos productos)
        {
            if (id != productos.IdProducto)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductosExists(productos.IdProducto))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCategoriaProducto"] = new SelectList(_context.CategoriaProductos, "IdCategoriaProducto", "Nombre", productos.IdCategoriaProducto);
            return(View(productos));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,BirthDate,BirthPlace,Photo,ImageType")] Musician musician)
        {
            if (id != musician.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(musician);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MusicianExists(musician.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(musician));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Genre genre)
        {
            if (id != genre.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(genre);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GenreExists(genre.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(genre));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdUsuario,IdRol,Username,Clave,Estado")] Usuarios usuarios)
        {
            if (id != usuarios.IdUsuario)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(usuarios);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsuariosExists(usuarios.IdUsuario))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdRol"] = new SelectList(_context.Roles, "IdRol", "DescripcionRol", usuarios.IdRol);
            return(View(usuarios));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,NameEn,NameEs,ISO2,ISO3")] Country country)
        {
            if (id != country.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(country));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdRol,NombreRol,DescripcionRol")] Roles roles)
        {
            if (id != roles.IdRol)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RolesExists(roles.IdRol))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(roles));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdRegistroVenta,IdEmpleado,IdTercero,TipoComprobante,NumComprobante,Subtotal,Impuesto,Total")] RegistroVentas registroVentas)
        {
            if (id != registroVentas.IdRegistroVenta)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registroVentas);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistroVentasExists(registroVentas.IdRegistroVenta))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdEmpleado"] = new SelectList(_context.Empleados, "IdEmpleado", "Apellido1", registroVentas.IdEmpleado);
            ViewData["IdTercero"]  = new SelectList(_context.Terceros, "IdTercero", "Direccion", registroVentas.IdTercero);
            return(View(registroVentas));
        }
示例#11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Year,PhotoCover,ImageType,ArtistId")] Album album)
        {
            if (id != album.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(album);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AlbumExists(album.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistId"] = new SelectList(_context.Artist, "Id", "Name", album.ArtistId);
            return(View(album));
        }
示例#12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TrackNumber,Title,Length,AlbumId,GenreId")] Song song)
        {
            if (id != song.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(song);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SongExists(song.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AlbumId"] = new SelectList(_context.Album, "Id", "Id", song.AlbumId);
            ViewData["GenreId"] = new SelectList(_context.Genre, "Id", "Id", song.GenreId);
            return(View(song));
        }
示例#13
0
        public async Task <IActionResult> Edit(int id, [Bind("IdTercero,IdCategoriaTercero,TipoDocumento,NumDocumento,RazonSocial,Nombre1,Nombre2,Apellido1,Apellido2,Telefono,Direccion,Ciudad,Email,PersonaContacto,TelefonContacto,Estado")] Terceros terceros)
        {
            if (id != terceros.IdTercero)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(terceros);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TercerosExists(terceros.IdTercero))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCategoriaTercero"] = new SelectList(_context.CategoriaTercero, "IdCategoriaTercero", "IdCategoriaTercero", terceros.IdCategoriaTercero);
            return(View(terceros));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdDetalleRegistroVentas,IdRegistroVenta,IdProducto,Cantidad,Precio,Descuento")] DetalleRegistroVentas detalleRegistroVentas)
        {
            if (id != detalleRegistroVentas.IdDetalleRegistroVentas)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(detalleRegistroVentas);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DetalleRegistroVentasExists(detalleRegistroVentas.IdDetalleRegistroVentas))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdProducto"]      = new SelectList(_context.Productos, "IdProducto", "Codigo", detalleRegistroVentas.IdProducto);
            ViewData["IdRegistroVenta"] = new SelectList(_context.RegistroVentas, "IdRegistroVenta", "NumComprobante", detalleRegistroVentas.IdRegistroVenta);
            return(View(detalleRegistroVentas));
        }