Esempio n. 1
0
        public async Task Add(PostRecord record)
        {
            if (await _routeService.ExistByPath(record.Route.Path))
                throw new ValidationException($"路由路径 '{record.Route.Path}' 已经存在!");

            _repository.Value.Create(record);
        }
Esempio n. 2
0
 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
     };
 }
Esempio n. 3
0
 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
     });
 }
Esempio n. 4
0
 public Task<PostRecord> GetBeforePost(PostRecord post)
 {
     return Table().OrderByDescending(i => i.CreateTime).FirstOrDefaultAsync(i => i.CreateTime < post.CreateTime);
 }
Esempio n. 5
0
 public Task<PostRecord> GetAfterPost(PostRecord post)
 {
     return Table().OrderBy(i => i.CreateTime).FirstOrDefaultAsync(i => i.CreateTime > post.CreateTime);
 }