示例#1
0
        public async Task <ObjectResultModule> CreateSubscribe([FromBody] Subscribe SubscribeInfo)
        {
            var userid          = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var CreateSubscribe = new Subscribe()
            {
                Subscriber   = SubscribeInfo.Subscriber,
                CallbackUrl  = SubscribeInfo.CallbackUrl,
                EventName    = SubscribeInfo.EventName,
                EventCode    = SubscribeInfo.EventCode,
                RegisterTime = SubscribeInfo.RegisterTime,
                ActionStatus = SubscribeInfo.ActionStatus,  // 默认true
                CreatedBy    = userid,
                CreatedOn    = DateTime.Now
            };
            var result = await _subscribeService.CreateSubscribe(CreateSubscribe);

            if (result.Id > 0)
            {
                this.ObjectResultModule.Object     = result;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            else
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 400;
                this.ObjectResultModule.Message    = "error!";
            }
            return(ObjectResultModule);
        }