/// <summary> /// 添加推送信息 /// </summary> /// <returns></returns> private async Task CreatePushText(PushTextAddOrEditInput input) { PushText pushText = input.PushText.MapTo <PushText>(); pushText.PushDateTime = DateTime.Now; await _pushTextRepository.InsertAsync(pushText); }
/// <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); } }
/// <summary> /// 添加或者更新 /// </summary> /// <returns></returns> public async Task AddOrUpdatePushText(PushTextAddOrEditInput input) { //是否存在有效值 if (input.PushText.Id.HasValue) { await UpdatePushText(input); } else { await CreatePushText(input); } }
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)); }