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

            commentUniversityViewModel.UserId = Convert.ToInt32(_signInManager.UserManager.GetUserId(User));
            _commentService.AddCommentUniversity(
                _mapper.Map <CommentUniversityViewModel, CommentUniversityDto>(commentUniversityViewModel));

            return(RedirectToAction("AddComment"));
        }