Esempio n. 1
0
        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 }));
        }
Esempio n. 2
0
 public static void SaveToDb(ClassDartDBContext db, object databaseObj)
 {
     db.Entry(databaseObj).State = EntityState.Modified;
     db.SaveChanges();
 }