public ActionResult <IEnumerable <ReactionReadDto> > GetForPost(int postId)
        {
            if (_postRepository.Get(postId) == null)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, "Post doesn't exist."));
            }

            List <Reaction> result = _reactionRepository.Get().Where(e => e.PostId == postId).ToList();

            return(StatusCode(StatusCodes.Status200OK, _mapper.Map <IEnumerable <ReactionReadDto> >(result)));
        }
Beispiel #2
0
        public Reaction GetReactionsByID(Int64 id, string lang = "en")
        {
            Reaction reaction = databasePlaceholder.Get(id, lang);

            if (reaction == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            return(reaction);
        }