Esempio n. 1
0
        public void Editaritem(byte accion, int idmarca = 0, int idrol = 0)
        {
            if (idmarca != 0)
            {
                var marca = _context.Marca.Single(x => x.Idmarca == idmarca);
                switch (accion)
                {
                case 1:
                    marca.Estado = true;
                    break;

                case 2:
                    marca.Estado = false;
                    break;
                }
            }
            else if (idrol != 0)
            {
                var rol = _context.Rol.Single(x => x.Idrol.Equals(idrol));
                switch (accion)
                {
                case 3:
                    rol.Estado = true;
                    break;

                case 4:
                    rol.Estado = false;
                    break;
                }
            }
            _context.SaveChanges();
        }
        public void ChangeStatus(int id, byte accion)
        {
            var producto = _context.Producto.Single(x => x.Idproducto == id);

            switch (accion)
            {
            case 0:
                producto.Estado = false;
                break;

            case 1:
                producto.Estado = true;
                break;
            }
            _context.SaveChanges();
        }