I have this code that uploads data
public async Task<int> UploadAllDeposit()
{
    tableSettings settings = App.ViewModelMaintenance.Setting;
    var q = from tableDeposit deposit in salesDB.Deposit
            where deposit.IsSync == false
            select deposit;
    int stat = 0;
    if (q.Count() > 0)
    {
        using (var client = new HttpClient())
        {
            client.BaseAddress = new Uri(App.ServiceURL);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            foreach (var item in q)
            {
                HttpResponseMessage depositResponse = await client.GetAsync("api/DepositSlip?DepositDate=" 
                   + item.DepositDate
                   + "&SalesDate=" + item.SalesDate
                   + "&MoneyCount=" + item.MoneyCount
                   + "&CompanyCode=" + item.DistributorCode
                   + "&UserCode=" + item.UserCode
                   + "&DeviceCode=" + item.DeviceCode
                   + "&RecordIdentity=" + item.RecordIdentity);
                if (depositResponse.IsSuccessStatusCode)
                {
                    int invStat = await depositResponse.Content.ReadAsAsync<int>();
                    if (invStat > 0)
                    {
                        tableDeposit updateDeposit = salesDB.Deposit.Single(x => x.DepositID == item.DepositID);
                        //updateDeposit.IsSync = true;
                        updateDeposit.SyncDate = DateTime.Now;
                        salesDB.SubmitChanges();
                    }
                    else
                        return 3;
                }
                else
                    return 2;
            }
        }
        stat = 1;
    }
    return stat;
}
What I want to do is to add image to this data to be uploaded.
I already have the byte array of the image. How can i upload it?
Can anyone please help me i dont know where to start.
Thank you!
                        
If you want to upload(POST) an image why you're using client.GetAsync method (GET). You need a POST method in order to upload something to the server.
You can use MultipartFormDataContent class and HttpClient.PostAsync method.
Your code will looks something like this: