public async Task <ActionResult> UpdateTransfer(UpdateTransferResponse update) { UpdateTransferResponse NewUpdate = new UpdateTransferResponse(); using (var httpClient = new HttpClient()) { string url = ConfigurationManager.AppSettings["RemitlyBaseURL"]; var content = new MultipartFormDataContent(); content.Add(new StringContent(update.Reference_Number), "Reference Number"); content.Add(new StringContent(update.Created_On), "Created On"); content.Add(new StringContent(update.Payer_Codes.ToString()), "Payer Code"); content.Add(new StringContent(update.Type), "Type"); content.Add(new StringContent(update.State), "State"); using (var response = await httpClient.PutAsync($"/IMTOAPI.Project/Remitly/UpdateTransfer/", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); ViewBag.Result = "Success"; var receivedUpdate = JsonConvert.DeserializeObject <UpdateTransferResponse>(apiResponse); } } return(View(NewUpdate)); }
public async Task <ActionResult> UpdateTransfer(int Id) { UpdateTransferResponse updateTransfer = new UpdateTransferResponse(); using (var httpClient = new HttpClient()) { string url = ConfigurationManager.AppSettings["RemitlyBaseURL"]; using (var response = await httpClient.GetAsync($"/IMTOAPI.Project/Remitly/UpdateTransfer" + Id)) { string UpdateResponse = await response.Content.ReadAsStringAsync(); updateTransfer = JsonConvert.DeserializeObject <UpdateTransferResponse>(UpdateResponse); } } return(View(updateTransfer)); }