示例#1
0
        public ActionResult Update(Models.Rol rol)
        {
            var _rol = db.Rol.Single(y => y.Id == rol.Id);

            _rol.Ad = rol.Ad;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Create(Models.Rol rol)
 {
     Models.Rol _rol = new Models.Rol();
     _rol.Ad = rol.Ad;
     db.Rol.Add(_rol);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#3
0
 public CustomAuthorizeAttribute(string rol1, string rol2 = "")
 {
     this.rol = (Models.Rol)Enum.Parse(typeof(Models.Rol), rol1); //Convierto en rol
     if (!string.IsNullOrEmpty(rol2))
     {
         this.rol2 = (Models.Rol)Enum.Parse(typeof(Models.Rol), rol2); //Convierto en rol
     }
 }
示例#4
0
        public ActionResult UpdateRol(Models.Rol rol)
        {
            OleDbConnection cn = new OleDbConnection(cadena);

            cn.Open();


            string id_rol      = rol.idstring;
            string descripcion = rol.Descripcion_Rol;
            bool   activo      = rol.deleted;

            string deleted = "";

            if (activo)
            {
                deleted = "1";
            }
            else
            {
                deleted = "0";
            }

            string query = "exec sp_editrol " + id_rol + ",'" + descripcion + "'," + deleted;

            OleDbCommand    cmd    = new OleDbCommand(query, cn);
            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ViewData["Error"] = reader.GetString(0);
            }



            return(View(rol));
        }
示例#5
0
 public IHttpActionResult postRol([FromBody] Models.Rol rol)
 {
     Connection.Instance.crear_Rol(rol);
     return(Ok());
 }