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(); } }
public void SaveNews(SaveNewsParameter param) { var repository = new NewsRepository(); repository.SaveNews(param); }