public async Task <ActionResult> Write(Notice notice) { notice.Content = await ImagebedClient.ReplaceImgSrc(notice.Content.ClearImgAttributes()); Notice e = NoticeService.AddEntitySaved(notice); return(e != null?ResultData(null, message : "发布成功") : ResultData(null, false, "发布失败")); }
public async Task <ActionResult> Write(Notice notice, CancellationToken cancellationToken) { notice.Content = await ImagebedClient.ReplaceImgSrc(notice.Content.ClearImgAttributes(), cancellationToken); if (notice.StartTime.HasValue && notice.EndTime.HasValue && notice.StartTime >= notice.EndTime) { return(ResultData(null, false, "开始时间不能小于结束时间")); } if (DateTime.Now < notice.StartTime) { notice.NoticeStatus = NoticeStatus.UnStart; } Notice e = NoticeService.AddEntitySaved(notice); return(e != null?ResultData(null, message : "发布成功") : ResultData(null, false, "发布失败")); }