示例#1
0
        public ActionResult Comment(CommentViewModel commentInfo)
        {
            _logger.Information("Starting to comment with {0}", JsonConvert.SerializeObject(commentInfo));
            if (ModelState.IsValid && _carManager.FindById(commentInfo.CarId) != null)
            {
                var comment = Mapper.Map <Comment>(commentInfo);//<Comment>(commentInfo);
                _commentManager.Comment(comment);

                _logger.Information("Commenting successful: comment {0}", JsonConvert.SerializeObject(comment));
                return(View("Success"));
            }
            else
            {
                _logger.Error("Commenting failed with invalid comment input {0}", JsonConvert.SerializeObject(commentInfo));
                return(View("Failed"));
            }
        }