コード例 #1
0
ファイル: TextDAL.cs プロジェクト: ztam/Swtor
 public static Text Load(string textName)
 {
     using (SwtorContext context = new SwtorContext())
     {
         var q = from text in context.Texts where text.Name == Constants.TestTextName select text;
         return q.FirstOrDefault();
     }
 }
コード例 #2
0
ファイル: TextDAL.cs プロジェクト: ztam/Swtor
 public static Text Save(int textId, string content)
 {
     using (SwtorContext context = new SwtorContext())
     {
         var text = context.Texts.Where(p => p.TextId == textId).FirstOrDefault();
         context.Entry(text).State = System.Data.EntityState.Modified;
         text.Content = content;
         context.SaveChanges();
         return text;
     }
 }