Пример #1
0
        public string InsertProfile(MProfile MProfile)
        {
            ProfileRequest  request  = new ProfileRequest();
            ProfileResponse response = new ProfileResponse();

            string returnMsg = string.Empty;

            request.Profile          = MProfile;
            request.Options          = MProfile.Options;
            request.ApplicationToken = ConfigurationManager.AppSettings["ApplicationToken"].ToString();

            string bodyrequest  = JsonConvert.SerializeObject(request);
            string statuscode   = string.Empty;
            string bodyresponse = new Helper().InvokeApi("security/api/Profile", "InsertProfile", bodyrequest, ref statuscode);

            if (statuscode.Equals("OK"))
            {
                response  = JsonConvert.DeserializeObject <ProfileResponse>(bodyresponse);
                returnMsg = response.Code + "|" + response.Message;
            }
            else
            {
                returnMsg = "2" + "|" + "Error invoking User api";
            }

            return(returnMsg);
        }
Пример #2
0
        public MProfile GetProfile(MProfile MProfile)
        {
            MProfile        profile  = new MProfile();
            ProfileRequest  request  = new ProfileRequest();
            ProfileResponse response = new ProfileResponse();

            request.Profile          = MProfile;
            request.ApplicationToken = ConfigurationManager.AppSettings["ApplicationToken"].ToString();

            string bodyrequest  = JsonConvert.SerializeObject(request);
            string statuscode   = string.Empty;
            string bodyresponse = new Helper().InvokeApi("security/api/Profile", "GetProfile", bodyrequest, ref statuscode);

            if (statuscode.Equals("OK"))
            {
                response = JsonConvert.DeserializeObject <ProfileResponse>(bodyresponse);

                if (response.Code.Equals("0"))
                {
                    profile         = response.Profile;
                    profile.Options = response.Options;
                }
            }

            return(profile);
        }