Exemplo n.º 1
0
        /***********Method  PostBookMark Added by:Zeeshan*******/
        public Boolean PostBookMark(string name, string text)
        {
            try
            {
                //build URI to get Image
                string strURI = Product.BaseProductUri + "/words/" + FileName + "/bookmarks/" + name;

                string signedURI = Utils.Sign(strURI);

                //serialize the JSON request content
                BookmarkData bookmarkData = new BookmarkData();
                bookmarkData.Name = name;
                bookmarkData.Text = text;

                string strJSON = JsonConvert.SerializeObject(bookmarkData);

                Stream responseStream = Utils.ProcessCommand(signedURI, "POST", strJSON);

                StreamReader reader      = new StreamReader(responseStream);
                string       strResponse = reader.ReadToEnd();

                //Parse the json string to JObject
                JObject pJSON = JObject.Parse(strResponse);

                BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(pJSON.ToString());

                if (baseResponse.Code == "200" && baseResponse.Status == "OK")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /***********Method  PostBookMark Added by:Zeeshan*******/
        public Boolean PostBookMark(string name, string text)
        {
            try
            {
                //build URI to get Image
                string strURI = Product.BaseProductUri + "/words/" + FileName + "/bookmarks/" + name;

                string signedURI = Utils.Sign(strURI);

                //serialize the JSON request content
                BookmarkData bookmarkData = new BookmarkData();
                bookmarkData.Name = name;
                bookmarkData.Text = text;

                string strJSON = JsonConvert.SerializeObject(bookmarkData);

                Stream responseStream = Utils.ProcessCommand(signedURI, "POST", strJSON);

                StreamReader reader = new StreamReader(responseStream);
                string strResponse = reader.ReadToEnd();

                //Parse the json string to JObject
                JObject pJSON = JObject.Parse(strResponse);

                BaseResponse baseResponse = JsonConvert.DeserializeObject<BaseResponse>(pJSON.ToString());

                if (baseResponse.Code == "200" && baseResponse.Status == "OK")
                    return true;
                else
                    return false;

            }
            catch (Exception ex)
            {
                return false;
            }
        }