Exemplo n.º 1
0
        public IActionResult Reply(CreateCommentViewModel replyComment)
        {
            if (!ModelState.IsValid)
            {
                return(View(nameof(Reply), replyComment));
            }

            var game = _gameService.Get(replyComment.GameKey);

            if (game.IsDeleted)
            {
                return(RedirectToAction("NotFound", "Game"));
            }

            var comment = _mapper.Map <Comment>(replyComment);

            _commentService.AnswerComment(comment, replyComment.GameKey);

            return(RedirectToAction("GetDetails", "Game", new { gameKey = replyComment.GameKey }));
        }
Exemplo n.º 2
0
        public IActionResult Reply(CreateCommentViewModel replyComment)
        {
            var hotel = _hotelService.Get(replyComment.HotelId);

            if (hotel.IsDeleted)
            {
                return(RedirectToAction("NotFound", "Hotel"));
            }

            if (ModelState.IsValid)
            {
                var comment = _mapper.Map <Comment>(replyComment);

                _commentService.AnswerComment(comment, replyComment.HotelId);

                return(RedirectToAction("GetDetailsByKey", "Hotel", new { hotelId = replyComment.HotelId }));
            }


            return(View(nameof(Reply), replyComment));
        }