Beispiel #1
0
        public bool AddImageToIssue(int id, string userId, string imageUrl)
        {
            var issue = this.issues.All()
                .Where(a => a.Id == id && a.UserId == userId)
                .FirstOrDefault();

            if (issue == null)
            {
                return false;
            }

            var imageData = new ImageData()
            {
                Url = imageUrl
            };

            if (issue.FrontImageData == null)
            {
                issue.FrontImageData = imageData;
            }

            issue.ImagesData.Add(imageData);
            this.issues.SaveChanges();

            return true;
        }
Beispiel #2
0
        public bool AddImageToParty(int id, string userId, string imageUrl)
        {
            var party = this.parties.All()
                .Where(a => a.Id == id && a.UserId == userId)
                .FirstOrDefault();

            if (party == null)
            {
                return false;
            }

            var imageData = new ImageData()
            {
                Url = imageUrl
            };

            if (party.FrontImageData == null)
            {
                party.FrontImageData = imageData;
            }

            party.ImagesData.Add(imageData);
            this.parties.SaveChanges();

            return true;
        }
 public HttpResponseMessage UploadImage(ImageData data)
 {
     //data = new ImageData() { Image = Library.ScreenMan.Instance.Grab(true, System.Drawing.Imaging.PixelFormat.Format24bppRgb) };
     return Request.GetResponse<string>(RhsApi.UploadImage(data), responseType);
 }
 public static string UploadImage(ImageData data)
 {
     try
     {
         var file = GetFile("~/App_Data/DataFromClient/", data.FileName);
         var content = Convert.FromBase64String(data.Image);
         File.WriteAllBytes(file, content);
         if (data.Image.Length > 0)
         {
             return file;
         }
         return null;
     }
     catch { }
     return null;
 }
 public bool UploadImage(string fileName, Image bitmapImage, long quality)
 {
     try
     {
         var imgArray = Imaging.BitmapToJpeg(bitmapImage, quality);
         var request = new RestRequest("/RHS/UploadImage/{data}", Method.POST);
         var data = new ImageData()
         {
             FileName = fileName,
             Image = Convert.ToBase64String(imgArray),
             Token = Auth.Token
         };
         data.ComputerHash = TSettings.ComputerHash;
         request.AddObject(data);
         var response = client.Execute(request);
         return response.Content != null && response.Content.Length > 0;
     }
     catch { }
     return false;
 }