コード例 #1
0
        public IHttpActionResult Post(BehaviorData behavior)
        {
            behavior.Created   = DateTime.Now.ToUniversalTime();
            behavior.IP        = HttpContext.Current.Request.UserHostAddress;
            behavior.UserAgent = HttpContext.Current.Request.UserAgent;
            behavior.Referrer  = behavior.Referrer ?? (HttpContext.Current.Request.UrlReferrer != null ? HttpContext.Current.Request.UrlReferrer.AbsoluteUri : String.Empty);
            _repository.Create(behavior);

            return(this.StatusCode(HttpStatusCode.Created));
        }
コード例 #2
0
        public void Invoke(string bodyMessage)
        {
            var behaviorData = JsonConvert.DeserializeObject <BehaviorData>(bodyMessage);

            Task.Run(() => _repository.Create(behaviorData));
        }