public async Task <ApiResponse <LikesQueryResult <Likes> > > GetAllLikesForPost(LikesQuery query) { ApiResponse <LikesQueryResult <Likes> > response = new ApiResponse <LikesQueryResult <Likes> >(); var resultMessage = ""; try { QueryResult <Likes> result = await _likeRepository.ListAsync(query); if (result == null || result.TotalItems == 0) { resultMessage = "Coult not find any likes for specified query"; throw new AppException(resultMessage); } resultMessage = "Data Retrieved"; response.Message = resultMessage; response.Status = Helpers.ApiReponseStatusCodes.Success; response.Data = new LikesQueryResult <Likes> { TotalLikes = result.TotalItems, Likes = result.Items, ViewPage = result.ViewPage, LikesPerPage = result.ItemsPerPage }; return(response); } catch (Exception ex) { _logger.Log(LogLevel.Error, ex.StackTrace); _logger.Log(LogLevel.Error, ex.Message); throw new AppException(ex.Message); } }