Example #1
0
        //-----------------------------------------------------actualiza
        public ActionResult actualizaMaterial(string ident)
        {
            string ruta = "/Material/actualizar";

            //sesion
            if (Session["token"] == null)
            {
                return(RedirectToAction("./")); //salir a login
            }
            else
            {
                //permisos
                string tk      = Session["token"].ToString();
                int    permiso = validate.validarPermisos(tk, ruta);
                if (permiso != 0)
                {
                    //code
                    Material    material     = new Material();
                    List <Tipo> tipoMaterial = new List <Tipo>();
                    material             = model.buscaMaterial(ident);
                    tipoMaterial         = tipoModel.listarTipoMaterial();
                    ViewBag.material     = material;
                    ViewBag.tipoMaterial = tipoMaterial;
                    ViewBag.nomUser      = Session["nombre"];
                    ViewBag.empresa      = Session["empresa"];
                    ViewBag.negocio      = Session["negocio"];
                    ViewBag.color        = Session["color"];
                    ViewBag.colorText    = Session["colorText"];
                    return(View());
                }
                else
                {
                    return(RedirectToAction("./")); //salir a login
                }
            }
        }