コード例 #1
0
 public void SaveNews(SaveNewsParameter param)
 {
     using (var context = base.CreateContext())
     {
         News pObj;
         if (param.RowID > 0)
         {
             pObj = context.News.Single(t => t.RowID == param.RowID);
             EntityMapper.Map <SaveNewsParameter, News>(param, pObj);
         }
         else
         {
             context.News.Add(pObj = new News());
             EntityMapper.Map <SaveNewsParameter, News>(param, pObj);
             pObj.CreateDate = DateTime.Now;
         }
         context.SaveChanges();
     }
 }
コード例 #2
0
        public void SaveNews(SaveNewsParameter param)
        {
            var repository = new NewsRepository();

            repository.SaveNews(param);
        }