I have a class Contacts.cs which contains class ContactsDTO, as shown in the below code
namespace WindowsScheduling
{
public class ContactsDTO
{
public string ContactFirstName { get; set; }
public string ContactLastName { get; set; }
public string ContactAddress1 { get; set; }
public string Class { get; set; }
}
}
Now I want to send an object List<ContactsDTO>
to an another project through REST API.
The method which I have implemented for this purpose is :-
public string SendContactToKentico( List<ContactsDTO> objDeserializedMessage)
{
var RemoteURL = ConfigurationManager.AppSettings["RemoteURL"].ToString();
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(RemoteURL);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage responseMessage = client.GetAsync(RemoteURL + "/Schedule/GetContactsByScheduler",objDeserializedMessage).Result;
return msg;
}
But here my objectDeserializedobject is showing an error :- Cannot convert from 'System.Collection.Generic.List' to 'System.Net.Http.HttpCompletionOption'