Пример #1
0
 public void UpdateItem(TapChiTacGia t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository <TapChiTacGia>();
         rep.Update(t);
     }
 }
Пример #2
0
        private void InsertTapChiTacGia(TapChi item)
        {
            // delete old data
            foreach (TapChiTacGia t in TapChiTacGiaManager.Instance.GetItems().Where(x => x.TapChiID == item.TapChiID).ToList())
            {
                TapChiTacGiaManager.Instance.DeleteItem(t);
            }

            // insert new data
            if (item.TacGiasPostBack != null)
            {
                foreach (int tid in item.TacGiasPostBack)
                {
                    TapChiTacGia t = new TapChiTacGia();
                    t.TacGiaID     = tid;
                    t.TapChiID     = item.TapChiID;
                    t.UserModified = t.UserCreated = User.Username;
                    TapChiTacGiaManager.Instance.CreateItem(t);
                }
            }
        }