public IHttpActionResult GetAllContacts(string campaignId, [FromUri] SalesForceCredentials credentials, [FromUri] string[] fields, [FromUri] int top = 0, [FromUri] bool translate = true)
        {
            if (!ModelState.IsValid)
            {
                return(Unauthorized());
            }

            crmService = new SalesForceService();

            if (crmService.Validate(credentials))
            {
                var contacts = crmService.GetContactsInCampaign(campaignId, translate, top, fields);

                return(Ok(contacts));
            }
            else
            {
                return(Unauthorized());
            }
        }
Esempio n. 2
0
        public IHttpActionResult GetAllContacts(string campaignId, [FromUri] SalesForceCredentials credentials, [FromUri] string[] fields, [FromUri] int top = 0, [FromUri] bool translate = true)
        {
            try
            {
                service = new SalesForceService();

                if (service.Validate(credentials))
                {
                    var contacts = service.GetContactsInCampaign(campaignId, translate, top, fields);
                    service.logout();

                    return(Ok(contacts));
                }
            }
            catch (NullReferenceException)
            {
                return(BadRequest());
            }

            return(Unauthorized());
        }