public IHttpActionResult GetAllCampaigns([FromUri] SalesForceCredentials credentials, [FromUri] bool translate = false)
        {
            if (!ModelState.IsValid)
            {
                return(Unauthorized());
            }

            crmService = new SalesForceService();

            if (crmService.Validate(credentials))
            {
                var campaigns = crmService.GetCampaigns(translate);

                return(Ok(campaigns));
            }
            else
            {
                return(Unauthorized());
            }
        }
Пример #2
0
        public IHttpActionResult GetAllCampaigns([FromUri] SalesForceCredentials credentials, [FromUri] bool translate = false)
        {
            try
            {
                service = new SalesForceService();

                if (service.Validate(credentials))
                {
                    var campaigns = service.GetCampaigns(translate);
                    service.logout();

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

            return(Unauthorized());
        }