示例#1
0
        public ActionResult Create(ENTIDADES.Usuario collection)
        {
            var mensajes = new List <KeyValuePair <string, string> >();

            try
            {
                // TODO: Add insert logic here

                collection.Habilitado = true;
                collection.Contrasena = SEGURIDAD.encriptarMD5(collection.Contrasena);
                var sw = LUsuario.add(collection, collection.IdPerfil, collection.IdFase);
                if (sw)
                {
                    mensajes.Add(Util.mensaje(Util.OK, Util.OKMENSAJE));
                }
                else
                {
                    mensajes.Add(Util.mensaje(Util.ERROR, Util.ERRORMENSAJE));
                }
                return(Json(mensajes));
            }
            catch (Exception ex)
            {
                mensajes.Clear();
                mensajes.Add(Util.mensaje(Util.ERROR, ex.Message));
                return(Json(mensajes));
            }
        }
        public ActionResult Create(Usuario collection)
        {
            var mensajes = new List <KeyValuePair <string, string> >();

            try
            {
                collection.Habilitado        = true;
                collection.CambiarContrasena = false;
                collection.EsSuperAdmin      = true;
                if (LUsuario.add(collection))
                {
                    mensajes.Add(Util.mensaje("OK", "Se guardo exitosamente"));
                }
                else
                {
                    mensajes.Add(Util.mensaje("ERROR", "No se puedo guardar"));
                }
                // TODO: Add insert logic
                return(Json(mensajes));
            }
            catch (Exception ex)
            {
                mensajes.Clear();
                mensajes.Add(Util.mensaje("ERROR", ex.Message));
                return(Json(mensajes));
            }
        }