Ejemplo n.º 1
0
        public async Task<IEnumerable<NewsFeedCommentRow>> CommentSelect(ToracGolfContext dbContext, int userId, int id, NewsFeedItemModel.NewsFeedTypeId newsFeedTypeId, ImageFinder userImageFinder)
        {
            var data = await CommentRepository.GetComments().AsNoTracking()
                         .Where(x => x.AreaId == id && x.NewsFeedTypeId == (int)newsFeedTypeId)
                         .OrderByDescending(x => x.CreatedDate)
                         .Select(CommentRepository.SelectCommand).ToListAsync().ConfigureAwait(false);

            data.ForEach(x => x.UserProfileUrl = userImageFinder.FindImage(x.UserIdThatMadeComment));

            return data;
        }
Ejemplo n.º 2
0
        public async Task<IEnumerable<NewsFeedCommentRow>> CommentAdd(ToracGolfContext dbContext, int userId, int id, NewsFeedItemModel.NewsFeedTypeId newsFeedTypeId, string commentToAdd, ImageFinder userImageFinder)
        {
            //lets go add the row
            await CommentRepository.Add(new NewsFeedComment
            {
                AreaId = id,
                NewsFeedTypeId = (int)newsFeedTypeId,
                UserIdThatCommented = userId,
                CreatedDate = DateTime.Now,
                Comment = commentToAdd
            });

            //go return this posts comment
            return await CommentSelect(dbContext, userId, id, newsFeedTypeId, userImageFinder);
        }
Ejemplo n.º 3
0
        public async Task<bool> NewsFeedLikeAdd(ToracGolfContext dbContext, int userId, int id, NewsFeedItemModel.NewsFeedTypeId newsFeedTypeId)
        {
            INewsFeedLikeRepository repository = new NewsFeedLikeRepository(dbContext);

            return await repository.AddOrRemoveLike(id, newsFeedTypeId, userId);
        }
Ejemplo n.º 4
0
 public async Task<NewsFeedQueryResult> NewsFeedPostSelect(int userId, NewsFeedItemModel.NewsFeedTypeId? newsFeedTypeIdFilter, string searchFilterText, ImageFinder courseImageLocator, ImageFinder userImageLocator)
 {
     return await GridQueryRepository.NewsFeedPostSelect(userId, newsFeedTypeIdFilter, searchFilterText, courseImageLocator, userImageLocator).ConfigureAwait(false);
 }