Ejemplo n.º 1
0
        public IActionResult ReplyToComment(string id, string roadId, DetailsRoadViewModel model)
        {
            var replyViewModel = model.Reply;
            var user           = this.usersService.GetUserByUsername(this.User.Identity.Name);

            var result = this.commentsService.AddReplyToComment(id, replyViewModel.Content, user);

            return(this.RedirectToAction("Road", "Home", new { @id = roadId }));
        }
Ejemplo n.º 2
0
        public IActionResult Comment(string id, DetailsRoadViewModel model)
        {
            var commentViewModel = model.Comment;

            commentViewModel.Commentator = this.usersService.GetUserByUsername(this.User.Identity.Name);
            commentViewModel.RoadId      = id;

            var result = this.commentsService.AddCommentToRoad(id, commentViewModel.Commentator, commentViewModel.Rating,
                                                               commentViewModel.Comment);

            if (result == false)
            {
                return(this.BadRequest());
            }

            return(this.RedirectToAction("Road", "Home", new { @id = id }));
        }