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()); } }
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()); } }
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()); } }
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()); } }
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()); } }
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()); } }
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()); } }
public bool MarkDel(long tagId) { using (InShareContext db = new InShareContext()) { BaseService <TagEntity> baseService = new BaseService <TagEntity>(db); return(baseService.MakeDel(tagId)); } }
public TagEntity GetTagById(long id) { using (InShareContext db = new InShareContext()) { BaseService <TagEntity> baseService = new BaseService <TagEntity>(db); return(baseService.GetById(id)); } }
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()); } }
public bool ReMark(long userId) { using (InShareContext db = new InShareContext()) { BaseService <UserEntity> baseService = new BaseService <UserEntity>(db); return(baseService.ReMake(userId)); } }
public bool MarkBatchDel(long[] userIds) { using (InShareContext db = new InShareContext()) { BaseService <UserEntity> baseService = new BaseService <UserEntity>(db); return(baseService.MakeDels(userIds)); } }
public bool ReMarkBatch(long[] postIds) { using (InShareContext db = new InShareContext()) { BaseService <PostEntity> baseService = new BaseService <PostEntity>(db); return(baseService.ReMakes(postIds)); } }
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)); } }
public bool Delete(long postId) { using (InShareContext db = new InShareContext()) { BaseService <PostEntity> baseService = new BaseService <PostEntity>(db); return(baseService.MakeDel(postId)); } }
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()); } }
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()); } }
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()); } }
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()); } }
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); } }
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()); } }
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)); } }
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()); } }
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()); } }
public bool ReMark(long postId) { using (InShareContext db = new InShareContext()) { BaseService <PostEntity> baseService = new BaseService <PostEntity>(db); return(baseService.ReMake(postId)); } }
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)); } }
/// <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)); } }