Ejemplo n.º 1
0
        /// <summary>
        /// Create a sale picture. The following formats are supported: JPG, PNG, and GIF. Set the
        /// byte array on the salePicture object to upload the pic.
        /// </summary>
        public SalePicture CreateSalePicture(SalePicture salePicture)
        {
            RestRequest request = this.CreateRestRequest("/api/sale-pictures/", Method.POST, salePicture);
            IRestResponse <SalePicture> response = this.restClient.Post <SalePicture>(request);

            response.VaildateResponse();

            return(response.Data);
        }
        public static SalePicture GetSalePicture(int saleId, string description, string picturePath)
        {
            byte[] imageData = File.ReadAllBytes(picturePath);

            SalePicture picture = new SalePicture()
            {
                SaleId      = saleId,
                Description = description,
                ImageData   = imageData
            };

            return(picture.ValidateBusinessRules());
        }