public Response WriteArticle(WriteArticleM article) { int result = 0; Response response = new Response(); WriteArticleMValidator validator = new WriteArticleMValidator(); ValidationResult results = validator.Validate(article); if (results.Errors.Count > 0) { throw new ValidationException("입력값을 확인해주세요.", results.Errors.Join("\r\n"), LayerID.BoardController); } ArticleT entity = mapper.Map <WriteArticleM, ArticleT>(article); result = boardService.CreateArticle(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); }