示例#1
0
 public void DeleteText(Texts ent)
 {
     AllTexts.Remove(ent);
     nlDB.Texts.DeleteOnSubmit(ent);
     nlDB.SubmitChanges();
 }
示例#2
0
 public void AddText(Texts ent)
 {
     var exists = from t in nlDB.Texts
                  where t.TextId == ent.TextId
                  select t;
     if (exists.Count() == 0)
     {
         nlDB.Texts.InsertOnSubmit(ent);
         AllTexts.Add(ent);
     }
     else
     {
         Texts t = exists.FirstOrDefault();
         t.Title = ent.Title;
         t.Content = ent.Content;
     }
     nlDB.SubmitChanges();
 }