public int AddArticle(ArticleM article) { var tran = new TransactionScope(); try { //把文章数据写入数据库 var articleDa = new ArticleDA(); articleDa.AddArticle(article); //为新增加的文章生成静态页面 //文章作者增加积分 //写日志 //提交事务 tran.Complete(); } catch(Exception ex) { throw ex; } finally { tran.Dispose(); } return 1; }
public int AddArticle(ArticleM article) { var tran = new TransactionScope(); try { //把文章数据写入数据库 var articleDa = new ArticleDA(); articleDa.AddArticle(article); //为新增加的文章生成静态页面 //文章作者增加积分 //写日志 //提交事务 tran.Complete(); } catch (Exception ex) { throw ex; } finally { tran.Dispose(); } return(1); }
public Response <ArticleM> ReadArticle(string seq) { Response <ArticleM> response = new Response <ArticleM>(); ArticleT entity = boardService.GetArticle(seq); ArticleM model = mapper.Map <ArticleT, ArticleM>(entity); if (model != null) { response.Result = model; response.Status = ((int)HttpStatusCode.OK).ToString(); } else { throw new NotFoundException("게시글이 없습니다.", "게시글 없음", LayerID.BoardController); } logger.Log(LogLevel.Info, string.Format("호출 성공 : {0}", MethodBase.GetCurrentMethod().Name)); return(response); }