public async Task Add(PostRecord record) { if (await _routeService.ExistByPath(record.Route.Path)) throw new ValidationException($"路由路径 '{record.Route.Path}' 已经存在!"); _repository.Value.Create(record); }
public static PostCommentRecord Create(string nickName, string content, PostRecord post) { return new PostCommentRecord { Id = Guid.NewGuid().ToString("N"), NickName = nickName, Content = content, CreateTime = DateTime.Now, Post = post }; }
public static PostCommentRecord Create(string nickName, string content, PostRecord post) { return(new PostCommentRecord { Id = Guid.NewGuid().ToString("N"), NickName = nickName, Content = content, CreateTime = DateTime.Now, Post = post }); }
public Task<PostRecord> GetBeforePost(PostRecord post) { return Table().OrderByDescending(i => i.CreateTime).FirstOrDefaultAsync(i => i.CreateTime < post.CreateTime); }
public Task<PostRecord> GetAfterPost(PostRecord post) { return Table().OrderBy(i => i.CreateTime).FirstOrDefaultAsync(i => i.CreateTime > post.CreateTime); }