Exemple #1
0
        /// <inheritdoc />
        public async Task <PagedList <Like> > GetAll(LikeParameters parameters = null)
        {
            var likes = this.GetQueryable();

            if (parameters != null)
            {
                if (string.IsNullOrWhiteSpace(parameters.OrderBy) == false)
                {
                    if (parameters.OrderBy == nameof(Like.CreatedAt).ToLowerCamelCase())
                    {
                        likes = likes.OrderByDescending(l => l.CreatedAt);
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException(nameof(parameters.OrderBy), parameters.OrderBy, null);
                    }
                }
            }
            else
            {
                parameters = new LikeParameters();
            }

            return(await PagedList <Like> .CreateAsync(likes, parameters.PageNumber, parameters.PageSize));
        }
Exemple #2
0
        /// <inheritdoc />
        public async Task <PagedList <Like> > GetByRecipientUser(Guid userID, LikeParameters parameters)
        {
            var likes = this.GetQueryableByRecipientUser(userID);

            return(await PagedList <Like> .CreateAsync(likes, parameters.PageNumber, parameters.PageSize));
        }