// GET: Home/Details/5 public ActionResult Details(long id) { using (ContactService.ContactServiceClient client = new ContactService.ContactServiceClient()) { ContactModel model = Mapper.Map <ContactModel>(client.GetContactById(id)); return(View(model)); } }
// GET: Home/Edit/5 public ActionResult Edit(int id) { ViewBag.Pays = pays; using (ContactService.ContactServiceClient client = new ContactService.ContactServiceClient()) { ContactModel model = Mapper.Map <ContactModel>(client.GetContactById(id)); return(View(model)); } }
// GET: Home public ActionResult Index() { List <ContactModel> models = new List <ContactModel>(); using (ContactService.ContactServiceClient client = new ContactService.ContactServiceClient()) { models = Mapper.Map <List <ContactModel> >(client.GetAllContacts()); } return(View(models)); }
private static void ContactService_QuickAndDirtyTestMethod() { var contactClient = new ContactService.ContactServiceClient("BasicHttpBinding_IContactService"); contactClient.ClientCredentials.UserName.UserName = GwslUser; contactClient.ClientCredentials.UserName.Password = GwslPassword; //Idempotent operation, meaning that the state of the contact in 360 is unchanged no matter how many times the same request is repeated. var createContactResult = contactClient.SynchronizePrivatePerson(new ContactService.SynchronizePrivatePersonParameter() { //ADContextUser = "******", //Add to run as a different user than the integration user in 360. ExternalID = "24079026111", //Your external ID which can be used for finding the same contact later. Can be any unique ID. PersonalIdNumber = "24079026111", FirstName = "Testfirstname", LastName = "Testlastname", Email = "*****@*****.**", MobilePhone = "+4711223344", PostAddress = new ContactService.Address() { StreetAddress = "Monrads gate 21B", ZipCode = "0564", ZipPlace = "Oslo", Country = "Norge" } }); Console.WriteLine("Create contact result: \n" + Newtonsoft.Json.JsonConvert.SerializeObject(createContactResult)); var getContactsResult = contactClient.GetPrivatePersons(new ContactService.GetPrivatePersonsParameter() { //ADContextUser = "******", //Add to run as a different user than the integration user in 360. ExternalID = "24079026111" //or PersonalIdNumber = "24079026111" }); if (getContactsResult.Successful) { Console.WriteLine("\nContacts ({0}):", getContactsResult.PrivatePersons.Length); foreach (var privatePerson in getContactsResult.PrivatePersons) { Console.WriteLine(privatePerson.ExternalID + ": " + privatePerson.FirstName + " " + privatePerson.LastName); } } }
public ActionResult Edit(ContactModel model) { ViewBag.Pays = pays; try { if (!ModelState.IsValid) { return(View(model)); } var entity = Mapper.Map <ContactService.Contact>(model); using (ContactService.ContactServiceClient client = new ContactService.ContactServiceClient()) { client.SaveContact(entity); } return(RedirectToAction("Index")); } catch { return(View(model)); } }
private static void ContactService_QuickAndDirtyTestMethod_UsingNtlm() { var contactClient = new ContactService.ContactServiceClient("NtlmHttpBinding_IContactService"); var createContactResult = contactClient.SynchronizePrivatePerson(new ContactService.SynchronizePrivatePersonParameter() { //ADContextUser = "******", //Add to run as a different user than the integration user in 360. ExternalID = "24079026111", //Your external ID which can be used for finding the same contact later. Can be any unique ID. PersonalIdNumber = "24079026111", FirstName = "Testfirstname", LastName = "Testlastname", Email = "*****@*****.**", MobilePhone = "+4711223344", PostAddress = new ContactService.Address() { StreetAddress = "Monrads gate 21B", ZipCode = "0564", ZipPlace = "Oslo", Country = "Norge" } }); Console.WriteLine("Create contact result: \n" + Newtonsoft.Json.JsonConvert.SerializeObject(createContactResult)); }