public Informs DeleteNews(int InformsID) { Informs dbEntry = context.Informs.Find(InformsID); if (dbEntry != null) { context.Informs.Remove(dbEntry); context.SaveChanges(); } return(dbEntry); }
public void SaveInfroms(Informs Informs) { if (Informs.ID == 0) { context.Informs.Add(Informs); } else { Informs dbEntry = context.Informs.Find(Informs.ID); if (dbEntry != null) { dbEntry.Title = Informs.Title; dbEntry.Time = Informs.Time; dbEntry.Content = Informs.Content; dbEntry.Document = Informs.Document; dbEntry.Remark = Informs.Remark; } } context.SaveChanges(); }