示例#1
0
        public virtual JObject SaveRole(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    mode    = request.GetString("mode");

            JObject data = request.GetPostData <JObject>();
            Role    role = data["Role"].ToObject <Role>();
            BPMObjectNameCollection members = data["Members"].ToObject <BPMObjectNameCollection>();
            Role newRole = null;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                if (mode == "edit")
                {
                    newRole = Role.UpdateRole(cn, request.GetString("fullname"), role, members);
                }
                else
                {
                    newRole = OU.AddRole(cn, request.GetString("parentou"), role, members);
                }
            }

            return(this.SerializeOUObject(newRole));
        }