Exemple #1
0
 public List <UserEntity> GetUserPagerList(int pageSize, int pageIndex, bool flag = false)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <UserEntity> baseService = new BaseService <UserEntity>(db);
         return(baseService.GetPager <DateTime>(u => 1 == 1, u => u.CreateDateTime, pageSize, pageIndex, flag).Include(u => u.Profile).ToList());
     }
 }
Exemple #2
0
 public int GetFollowingCount(long userId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <FollowEntity> baseService = new BaseService <FollowEntity>(db);
         return(baseService.GetAll().Where(f => f.FollowId == userId).Count());
     }
 }
Exemple #3
0
 public List <long> GetFollowingPagerList(long userId, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <FollowEntity> baseService = new BaseService <FollowEntity>(db);
         return(baseService.GetPager <DateTime>(f => f.FollowId == userId, f => f.CreateDateTime, pageSize, pageIndex).Select(f => f.FollowedId).ToList());
     }
 }
Exemple #4
0
 public List <long> GetLikePagerList(long postId, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <LikerEntity> baseService = new BaseService <LikerEntity>(db);
         return(baseService.GetAll().Where(l => l.PostId == postId).Skip(pageSize * pageIndex).Take(pageSize).Select(p => p.UserId).ToList());
     }
 }
Exemple #5
0
 public bool Login(string userName, string password)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <AdminUserEntity> baseService = new BaseService <AdminUserEntity>(db);
         return(baseService.GetAll().Any(a => a.UserName == userName && a.Password == password));
     }
 }
 public bool DeleteById(long commentId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <CommentEntity> baseService = new BaseService <CommentEntity>(db);
         return(baseService.MakeDel(commentId));
     }
 }
 public List <CommentEntity> GetReCommentPagerList(long commentId, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <CommentEntity> baseService = new BaseService <CommentEntity>(db);
         return(baseService.GetPager <DateTime>(c => c.ParentId == commentId, c => c.CreateDateTime, pageSize, pageIndex).Include(c => c.Owner).ToList());
     }
 }
Exemple #8
0
 public List <TagEntity> GetTagList(string name)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <TagEntity> baseService = new BaseService <TagEntity>(db);
         return(baseService.GetAll().Where(t => t.Name == name).ToList());
     }
 }
Exemple #9
0
 public List <TagEntity> GetTagPagerList(string name, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <TagEntity> baseService = new BaseService <TagEntity>(db);
         return(baseService.GetAll().Where(t => t.Name == name).Skip(pageSize * pageIndex).Take(pageSize).ToList());
     }
 }
Exemple #10
0
 public bool MarkDel(long tagId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <TagEntity> baseService = new BaseService <TagEntity>(db);
         return(baseService.MakeDel(tagId));
     }
 }
Exemple #11
0
 public TagEntity GetTagById(long id)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <TagEntity> baseService = new BaseService <TagEntity>(db);
         return(baseService.GetById(id));
     }
 }
Exemple #12
0
 public List <LogEntity> GetLogPagerList(long userId, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <LogEntity> baseService = new BaseService <LogEntity>(db);
         return(baseService.GetAll().Where(l => l.UserId == userId).Skip(pageSize * pageIndex).Take(pageSize).ToList());
     }
 }
Exemple #13
0
 public bool ReMark(long userId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <UserEntity> baseService = new BaseService <UserEntity>(db);
         return(baseService.ReMake(userId));
     }
 }
Exemple #14
0
 public bool MarkBatchDel(long[] userIds)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <UserEntity> baseService = new BaseService <UserEntity>(db);
         return(baseService.MakeDels(userIds));
     }
 }
Exemple #15
0
 public bool ReMarkBatch(long[] postIds)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.ReMakes(postIds));
     }
 }
Exemple #16
0
 public TagEntity GetTagByName(string name)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <TagEntity> baseService = new BaseService <TagEntity>(db);
         return(baseService.GetAll().FirstOrDefault(t => t.Name == name));
     }
 }
Exemple #17
0
 public bool Delete(long postId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.MakeDel(postId));
     }
 }
Exemple #18
0
 public PostEntity GetPostInfo(long postId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.GetById(postId));
     }
 }
 public int GetCommentCount(long postId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <CommentEntity> baseService = new BaseService <CommentEntity>(db);
         return(baseService.GetAll().Where(c => c.PostId == postId).Count());
     }
 }
Exemple #20
0
 public List <PostEntity> GetPostPagerList(long userId, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.GetPager <DateTime>(p => p.UserId == userId, p => p.CreateDateTime, pageSize, pageIndex).Include(p => p.Owner).Include(p => p.Tags).ToList());
     }
 }
Exemple #21
0
 public int GetLikeCountByUser(long userId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <LikerEntity> baseService = new BaseService <LikerEntity>(db);
         return(baseService.GetAll().Where(l => l.UserId == userId).Count());
     }
 }
Exemple #22
0
 public List <PostEntity> GetSearchPager(long tagId, int pageSize, int pageIndex)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.GetPager <DateTime>(p => p.Tags.Any(t => t.Id == tagId), p => p.CreateDateTime, pageSize, pageIndex).Include(p => p.Owner).Include(p => p.Tags).ToList());
     }
 }
Exemple #23
0
 public bool IsLiked(long accountId, long postId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <LikerEntity> baseService = new BaseService <LikerEntity>(db);
         return(baseService.GetAll().FirstOrDefault(l => l.PostId == postId && l.UserId == accountId) != null);
     }
 }
Exemple #24
0
 public int GetUserCountByTag(long tagId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.GetAll().Where(p => p.Tags.Any(t => t.Id == tagId)).GroupBy(p => p.UserId).Count());
     }
 }
Exemple #25
0
 public VerifyEntity GetVerify(long userId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <VerifyEntity> baseService = new BaseService <VerifyEntity>(db);
         return(baseService.GetAll().FirstOrDefault(v => v.UserId == userId && v.IsValid));
     }
 }
Exemple #26
0
 public List <PostEntity> GetPostPagerList(int pageSize, int pageIndex, bool flag = false)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.GetPager <DateTime>(p => 1 == 1, p => p.CreateDateTime, pageSize, pageIndex, flag).Include(p => p.Owner).Include(p => p.Tags).ToList());
     }
 }
Exemple #27
0
 public List <long> GetFollowingList(long userId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <FollowEntity> baseService = new BaseService <FollowEntity>(db);
         return(baseService.GetAll().Where(f => f.FollowId == userId).Select(f => f.FollowedId).ToList());
     }
 }
Exemple #28
0
 public bool ReMark(long postId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <PostEntity> baseService = new BaseService <PostEntity>(db);
         return(baseService.ReMake(postId));
     }
 }
Exemple #29
0
 public bool IsFollowing(long accountId, long userId)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <FollowEntity> baseService = new BaseService <FollowEntity>(db);
         return(baseService.GetAll().Any(f => f.FollowId == accountId && f.FollowedId == userId));
     }
 }
Exemple #30
0
 /// <summary>
 /// 根据账号获取用户
 /// </summary>
 /// <param name="userName"></param>
 /// <returns></returns>
 public UserEntity GetUserByUserName(string userName)
 {
     using (InShareContext db = new InShareContext())
     {
         BaseService <UserEntity> baseService = new BaseService <UserEntity>(db);
         return(baseService.GetAll().FirstOrDefault(u => u.UserName == userName));
     }
 }