Пример #1
0
        public AllIntroduce DeleteAllIntroduce(int AllIntroduceID)
        {
            AllIntroduce dbEntry = context.AllIntroduce.Find(AllIntroduceID);

            if (dbEntry != null)
            {
                context.AllIntroduce.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
Пример #2
0
 public void SaveAllIntroduce(AllIntroduce AllIntroduce)
 {
     if (AllIntroduce.ID == 0)
     {
         context.AllIntroduce.Add(AllIntroduce);
     }
     else
     {
         AllIntroduce dbEntry = context.AllIntroduce.Find(AllIntroduce.ID);
         if (dbEntry != null)
         {
             dbEntry.Title   = AllIntroduce.Title;
             dbEntry.Content = AllIntroduce.Content;
             dbEntry.Remark  = AllIntroduce.Remark;
         }
     }
     context.SaveChanges();
 }