private Like GetLikeByUserAndKweetId(int userId, int kweetId) { ServiceHelpers.CheckValidId(userId); ServiceHelpers.CheckValidId(kweetId); return(_repository.Find(l => l.UserId.Equals(userId) && l.KweetId.Equals(kweetId))); }
public bool TryFindByUserAndFollowsId(int userId, int followsId, out Follower follower) { ServiceHelpers.CheckValidId(userId); ServiceHelpers.CheckValidId(followsId); follower = _repository.Find(f => f.UserId.Equals(userId) && f.FollowsId.Equals(followsId)); return(follower != null); }
public async Task <ICollection <Kweet> > GetTimeLineForUserIdAsync(int userId, int from, int to) { ServiceHelpers.CheckValidId(userId); ServiceHelpers.CheckRange(from, to); return(await _repository.GetNewestKweetsByQueryAsync( (kweet => kweet.UserId.Equals(userId) || kweet.User.Followers.Any(f => f.UserId.Equals(userId))), from, to)); }
public async Task RemoveRangeByKweetIdAsync(int kweetId) { ServiceHelpers.CheckValidId(kweetId); var likes = await _repository.FindRangeAsync(l => l.KweetId.Equals(kweetId)); if (likes.Count > 0) { _repository.DeleteRange(likes); } }
public async Task RemoveRangeByKweetIdAsync(int kweetId) { ServiceHelpers.CheckValidId(kweetId); var hashTagInKweets = await _repository.FindRangeAsync(h => h.KweetId.Equals(kweetId)); if (hashTagInKweets.Count > 0) { _repository.DeleteRange(hashTagInKweets); } }
public async Task RemoveRangeByUserIdAsync(int userId) { ServiceHelpers.CheckValidId(userId); var followers = await _repository.FindRangeAsync(f => f.FollowsId.Equals(userId) || f.UserId.Equals(userId)); if (followers.Count > 0) { _repository.DeleteRange(followers); } }
public async Task <Kweet> GetKweetWithLikesAsync(int id) { ServiceHelpers.CheckValidId(id); return(await _repository.FindAsync(k => k.Id.Equals(id))); }
public async Task <IEnumerable <HashTag> > GetTopAsync(int amount) { ServiceHelpers.CheckValidId(amount); return(await _repository.GetTopAsync(amount)); }
public async Task <ICollection <ApplicationUser> > GetFollowers(int userId) { ServiceHelpers.CheckValidId(userId); return(await _repository.GetFollowers(userId)); }
public async Task <ApplicationUser> GetById(int userId) { ServiceHelpers.CheckValidId(userId); return(await _repository.FindAsync(u => u.Id.Equals(userId))); }