public ActionResult DeleteAnnouncementConfirmed(int id, int index) { Class classObj = db.Classes.Find(id); if (classObj == null) { return(HttpNotFound()); } IList <Announcement> currentAnnouncements = V1.DeserializeAnnouncements(classObj.Announcements); currentAnnouncements.RemoveAt(index); classObj.Announcements = V1.SerializeAnnouncements(currentAnnouncements); //save classObj in DB db.Entry(classObj).State = EntityState.Modified; db.SaveChanges(); Utilities.SaveToClassDart(classObj, null); return(RedirectToAction("Index", "Editor", new { id = id })); }
public static void SaveToDb(ClassDartDBContext db, object databaseObj) { db.Entry(databaseObj).State = EntityState.Modified; db.SaveChanges(); }