public ActionResult Add(UI.Models.PortalContact contact) { Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient(); string jsoncontact = Newtonsoft.Json.JsonConvert.SerializeObject(contact); appclient.CreateContact(Session["companyid"].ToString(), Session["companyid"].ToString(), Guid.NewGuid().ToString().Replace("-", ""), contact.designation, contact.title, contact.firstname, contact.lastname, contact.emailaddress, contact.officephone, contact.secondaryemail, contact.mobilephone, jsoncontact, contact.objecttype, "", Session["companyid"].ToString()); return(RedirectToAction("index")); }
public ActionResult Index() { Business.ApplicationService.AppServiceClient appclient = new Business.ApplicationService.AppServiceClient(); Business.ApplicationService.contact[] contacts = appclient.GetContacts(Session["companyid"].ToString(), Session["companyid"].ToString(), "1", "100"); List <UI.Models.PortalContact> portalcontacts = new List <Models.PortalContact>(); foreach (Business.ApplicationService.contact contact in contacts) { UI.Models.PortalContact singlecontact = new Models.PortalContact(); try { UI.Models.PortalContact ObjContact = Newtonsoft.Json.JsonConvert.DeserializeObject <UI.Models.PortalContact>(contact.data); if (ObjContact == null) { singlecontact.Companyname = ""; singlecontact.middlename = ""; } else { singlecontact.Companyname = ObjContact.Companyname; singlecontact.middlename = ObjContact.middlename; } } catch { singlecontact.Companyname = ""; singlecontact.middlename = ""; } singlecontact.id = contact.contactid; singlecontact.firstname = contact.firstname; singlecontact.lastname = contact.lastname; singlecontact.emailaddress = contact.emailid; singlecontact.mobilephone = contact.mobile; singlecontact.officephone = contact.phone; singlecontact.objecttype = contact.objecttype; singlecontact.designation = contact.designation; portalcontacts.Add(singlecontact); } return(View(portalcontacts)); }