Example #1
0
        private bool ModifyAD(int index, string filePath)
        {
            byte[] fileBytes = File.ReadAllBytes(filePath);
            var    response  = WebRequestUtil.ReplaceAdsImg(index, Convert.ToBase64String(fileBytes));

            if (response != null)
            {
                int res = JsonUtil.Deserialize <QSWResponse <string> >(response.Content).Status;
                return(res == 1);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        private void ReplaceImage()
        {
            string imgName      = this.advModel.AdvId + Path.GetExtension(imagePath);
            var    contentBytes = File.ReadAllBytes(imagePath);
            string imgContent   = Convert.ToBase64String(contentBytes);
            var    replaceRes   = WebRequestUtil.ReplaceAdsImg(this.previousImg, imgName, imgContent);

            if (replaceRes != null)
            {
                LogUtil.Info("AddUpdateADFrm.ReplaceImage successfully!");
            }
            else
            {
                LogUtil.Error("AddUpdateADFrm.ReplaceImage failed!replaceRes is null!");
            }
        }