Ejemplo n.º 1
0
        public bool CreateReferral(string business_id, FacebookMessagingEvent referralEvent)
        {
            var    thread_id = ThreadService.FormatId(business_id, referralEvent.sender.id);
            var    threads   = _threadRepository.GetById(business_id, thread_id);
            string data      = referralEvent.postback != null && referralEvent.postback.referral != null && !string.IsNullOrWhiteSpace(referralEvent.postback.referral.Ref) ? referralEvent.postback.referral.Ref : referralEvent.referral != null && !string.IsNullOrWhiteSpace(referralEvent.referral.Ref) ? referralEvent.referral.Ref : "";

            data = data ?? "";
            data = data.Trim();
            if (!string.IsNullOrWhiteSpace(thread_id) && !string.IsNullOrWhiteSpace(business_id) && !string.IsNullOrWhiteSpace(data))
            {
                var referral = _referralService.CreateReferral(business_id, threads, referralEvent.timestamp.ToString(), referralEvent.sender.id, referralEvent.recipient.id, data, thread_id);
            }
            return(true);
        }