Exemple #1
0
        public IActionResult Post(ReviewPostCharacter reviewPostCharacter)
        {
            var currentUserProfile = GetCurrentUserProfile();
            var currentPost        = _reviewPostRepository.GetById(reviewPostCharacter.ReviewPostId);

            if (currentUserProfile.Id != currentPost.UserProfileId)
            {
                return(Unauthorized());
            }

            _characterRepository.AddCharacterToPost(reviewPostCharacter);
            return(CreatedAtAction("Get", new { id = reviewPostCharacter.Id }, reviewPostCharacter));
        }
        public IActionResult Get(int id)
        {
            var reviewPost = _reviewPostRepository.GetById(id);

            if (reviewPost == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(reviewPost));
            }
        }