示例#1
0
        /// <summary>
        /// 添加推送信息
        /// </summary>
        /// <returns></returns>
        private async Task CreatePushText(PushTextAddOrEditInput input)
        {
            PushText pushText = input.PushText.MapTo <PushText>();

            pushText.PushDateTime = DateTime.Now;
            await _pushTextRepository.InsertAsync(pushText);
        }
示例#2
0
        /// <summary>
        /// 更新推送信息
        /// </summary>
        /// <returns></returns>
        private async Task UpdatePushText(PushTextAddOrEditInput input)
        {
            var spiderTask = await _pushTextRepository.GetEntityByIdAsync(input.PushText.Id.Value);

            if (spiderTask != null)
            {
                var newSpiderTask = input.PushText.MapTo <PushText>();

                await _pushTextRepository.UpdateAsync(spiderTask);
            }
        }
示例#3
0
 /// <summary>
 /// 添加或者更新
 /// </summary>
 /// <returns></returns>
 public async Task AddOrUpdatePushText(PushTextAddOrEditInput input)
 {
     //是否存在有效值
     if (input.PushText.Id.HasValue)
     {
         await UpdatePushText(input);
     }
     else
     {
         await CreatePushText(input);
     }
 }
示例#4
0
        public async Task <IActionResult> ReceivePushText(PushTextAddOrEditInput input)
        {
            int    result = 0;
            string error  = string.Empty;

            try
            {
                await _chromeService.AddOrUpdatePushText(input);
            }
            catch (Exception e)
            {
                return(Json(e.Source + "---" + e.Message + "---" + e.StackTrace));
            }
            return(Json(result));
        }