Exemple #1
0
        public ActionResult Combo()
        {
            productobll = new ProductoBLLImp();
            List <Producto> productos;

            productos = productobll.BuscarTodos(Session["empresa"].ToString());
            String htmlCode = "<select id = \"rol\" class=\"form-control\" > ";

            foreach (Producto pr in productos)
            {
                htmlCode += "<option value = \"" + pr.idProducto + "\"  > " + pr.nombre + " </option >";
            }
            htmlCode += "</select>";
            return(Json(new { result = htmlCode }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Tabla()
        {
            productoBLL = new ProductoBLLImp();
            List <Producto> resultado = productoBLL.BuscarTodos(Session["empresa"].ToString());
            String          htmlCode  = String.Empty;

            foreach (Producto per in resultado)
            {
                htmlCode += "<tr>" +
                            "<td>" + per.idProducto + "</td>" +
                            "<td>" + per.nombre + "</td>" +
                            "<td>" + per.cantidad + "</td>" +
                            "<td>" + per.precioCompra + "</td>" +
                            "<td>" + per.precioVenta + "</td>" +
                            "<td class=\"text - right\" > " +
                            "<a href = \"#\" class=\"btn btn-simple btn-info btn-icon \" data-toggle=\"modal\" data-target=\"#myModal2\" ><i class=\"fa fa-user\"></i></a>" +
                            "<a href = \"#\" class=\"btn btn-simple btn-warning btn-icon \" data-toggle=\"modal\" data-target=\"#myModal1\" onclick=\"EditarAjax('" + per.idProducto + "')\"><i class=\"fa fa-edit\"></i></a>" +
                            "<a href = \"#\" onclick=\"warninMessage(); EliminarCargar('" + per.idProducto + "')\" class=\"btn btn-simple btn-danger btn-icon\" ><i class=\"fa fa-times\" ></i></a>" +
                            "</td>" +
                            "<tr>";
            }
            return(Json(new { result = htmlCode }, JsonRequestBehavior.AllowGet));
        }