public async Task <IActionResult> Edit(int id, [Bind("Idproducto,Idcategoria,Codigo,Nombre,PrecioVenta,Stock,Descripcion,Estado")] Producto producto)
        {
            if (id != producto.Idproducto)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(producto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductoExists(producto.Idproducto))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idcategoria"] = new SelectList(_context.Categoria, "Idcategoria", "Nombre", producto.Idcategoria);
            return(View(producto));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Idcategoria,Nombre,Descripcion,Estado")] Categoria categoria)
        {
            if (id != categoria.Idcategoria)
            {
                return(NotFound());
            }

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