Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (Image != null)
- {
- string urlMethod = Constants.BaseUrl + Constants.mob_sp_ECOMMERCE_SAVE_PRODUCT_PHOTO + "?comp_identifier=1&user_id=" + HttpUtility.UrlEncode(Comp_user_id) +
- "&prod_id=" + HttpUtility.UrlEncode(prod_id) + "&name_file=" + HttpUtility.UrlEncode(filename) + "&prod_type=I&prod_cover=" + HttpUtility.UrlEncode(cover_.ToString()) +
- "&prod_order=1&Token=" + Token;
- var client = new RestClient(urlMethod);
- client.Timeout = -1;
- var request = new RestRequest(Method.POST);
- request.AlwaysMultipartFormData = true;
- request.AddHeader("Content-Type", "multipart/form-data");
- var upfilebytes = File.ReadAllBytes(Image);
- request.AddFile("imagen", upfilebytes, filename);
- IRestResponse response = client.Execute(request);
- if (response.IsSuccessful)
- {
- var data = new mob_sp_ECOMMERCE_SAVE_PRODUCT_PHOTO();
- data = Newtonsoft.Json.JsonConvert.DeserializeObject<mob_sp_ECOMMERCE_SAVE_PRODUCT_PHOTO>(response.Content);
- if (data.result == "OK")
- {
- await GetProductInfo(prod_id);
- }
- else
- {
- await Application.Current.MainPage.DisplayAlert("", "Ocurrio un error en el servidor", "Ok");
- OnTask = false;
- IsBusy = false;
- }
- }
- else
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement