示例#1
0
        public IActionResult AddCommentCourse(CommentCourseViewModel commentCourseViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(Content(JsonConvert.SerializeObject("Not valid")));
            }

            commentCourseViewModel.UserId = Convert.ToInt32(_signInManager.UserManager.GetUserId(User));;
            _commentService.AddCommentCourse(_mapper.Map <CommentCourseViewModel, CommentCourseDto>(commentCourseViewModel));

            return(RedirectToAction("AddComment"));
        }