代码:

public void UpdateThemeInfo(int id)
        {
            //事务
            using (TransactionScope ctran = new TransactionScope())
            {
                try
                {
                    Models.ThemeInfo model = Models.ThemeInfo.Find(id);
                    if (model != null)
                    {
                        model.CreatDate = DateTime.Now;
                        model.Subject = "修改测试" + id;
                        model.Text = "修改测试内容" + id;
                    }
                    model.Update();
                    ctran.VoteCommit();
                }
                catch (Exception)
                {
                    ctran.VoteRollBack();
                }
            }
        }

  

posted on 2016-03-29 19:57  邢帅杰  阅读(147)  评论(0编辑  收藏  举报