public IActionResult Add(CommentViewModel comment, Guid hotelId) { var hotel = _hotelService.Get(comment.HotelId); if (!hotel.IsDeleted) { if (ModelState.IsValid) { var commentModel = _mapper.Map <Comment>(comment); _commentService.AddComment(commentModel, comment.HotelId); } } var hotelComments = _commentService.GetAllCommentsByGameKey(hotelId); var commentViewModel = new DisplayCommentViewModel { HotelId = hotelId, Comments = hotelComments }; return(PartialView("_CommentsRender", hotelComments)); }
public ViewResult GetDetails(string gameKey) { var game = _gameService.Get(gameKey); var displayGameView = new DisplayGameDetailsByKeyRequestModel(); if (game == null) { return(View(nameof(Index))); } var gameComments = _commentService.GetAllCommentsByGameKey(gameKey); var commentViewModel = new DisplayCommentViewModel { GameKey = gameKey, Comments = gameComments }; var gameViewModel = _mapper.Map <Game, GameViewModel>(game); displayGameView.GameViewModel = gameViewModel; displayGameView.GameKey = gameKey; displayGameView.Comments = commentViewModel; return(View(displayGameView)); }