Esempio n. 1
0
        public Response WriteSubComment(WriteSubCommentM comment)
        {
            int      result   = 0;
            Response response = new Response();

            WriteSubCommentMValidator validator = new WriteSubCommentMValidator();
            ValidationResult          results   = validator.Validate(comment);

            if (results.Errors.Count > 0)
            {
                throw new ValidationException("입력값을 확인해주세요.", results.Errors.Join("\r\n"), LayerID.BoardController);
            }

            CommentT entity = mapper.Map <WriteSubCommentM, CommentT>(comment);

            result = boardService.CreateSubComment(entity);

            if (result > 0)
            {
                response.Status  = ((int)HttpStatusCode.OK).ToString();
                response.Message = "대댓글 작성이 완료되었습니다.";
                logger.Log(LogLevel.Info, response.Message);
            }
            else
            {
                throw new BadRequestException("대댓글 작성이 실패하였습니다.", "대댓글 작성 오류", LayerID.BoardController);
            }

            logger.Log(LogLevel.Info, string.Format("호출 성공 : {0}", MethodBase.GetCurrentMethod().Name));
            return(response);
        }