public async Task <IActionResult> Edit(int id, [Bind("ProductoID,Nombre,categoria,Precio,Stock,VendedorID")] Producto producto)
        {
            if (id != producto.ProductoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(producto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductoExists(producto.ProductoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VendedorID"] = new SelectList(_context.Vendedors, "VendedorID", "VendedorID", producto.VendedorID);
            return(View(producto));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("CompraID,codigo,Importe,ConFactura,ConBoleta,SoloEfectivo,ClienteID")] Compra compra)
        {
            if (id != compra.CompraID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(compra);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompraExists(compra.CompraID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteID"] = new SelectList(_context.Clientes, "ClienteID", "ClienteID", compra.ClienteID);
            return(View(compra));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("VendedorID,Nombre,DNI,MercadoID")] Vendedor vendedor)
        {
            if (id != vendedor.VendedorID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vendedor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VendedorExists(vendedor.VendedorID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendedor));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("MercadoID,Nombre,Direccion,latitud,longitud")] Mercado mercado)
        {
            if (id != mercado.MercadoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mercado);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MercadoExists(mercado.MercadoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(mercado));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CompraMercadoID,CompraID,MercadoID")] CompraMercado compraMercado)
        {
            if (id != compraMercado.CompraMercadoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(compraMercado);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompraMercadoExists(compraMercado.CompraMercadoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompraID"]  = new SelectList(_context.Compras, "CompraID", "CompraID", compraMercado.CompraID);
            ViewData["MercadoID"] = new SelectList(_context.Mercados, "MercadoID", "MercadoID", compraMercado.MercadoID);
            return(View(compraMercado));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ClienteID,Usuario,Password,Correo,Nombre,Apellido,FechaNacimiento")] Cliente cliente)
        {
            if (id != cliente.ClienteID)
            {
                return(NotFound());
            }

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