/// <summary> /// 文章定时发布 /// </summary> /// <param name="p"></param> public void PublishPost(Post p) { p.Status = Status.Pended; p.PostDate = DateTime.Now; p.ModifyDate = DateTime.Now; Post post = _postService.GetById(p.Id); if (post is null) { _postService.AddEntitySaved(post); } else { post.Status = Status.Pended; post.PostDate = DateTime.Now; post.ModifyDate = DateTime.Now; _postService.UpdateEntitySaved(post); } }
/// <summary> /// 文章定时发布 /// </summary> /// <param name="p"></param> public void PublishPost(Post p) { p.Status = Status.Published; p.PostDate = DateTime.Now; p.ModifyDate = DateTime.Now; var post = _postService.GetById(p.Id); if (post is null) { _postService.AddEntitySaved(p); } else { post.Status = Status.Published; post.PostDate = DateTime.Now; post.ModifyDate = DateTime.Now; _postService.SaveChanges(); } }