Example #1
0
        public void DeleteClass(int id)
        {
            var db     = new ONTAPEntities();
            var @class = db.Classes.Find(id);

            db.Classes.Remove(@class);
            db.SaveChanges();
        }
Example #2
0
        public void EditClass(int id, string name, string description)
        {
            var db       = new ONTAPEntities();
            var oldClass = db.Classes.Find(id);

            oldClass.NAME        = name;
            oldClass.DESCRIPTION = description;

            db.Entry(oldClass).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Example #3
0
        public void AddClass(string name, string description)
        {
            var newClass = new Class();

            newClass.NAME        = name;
            newClass.DESCRIPTION = description;

            var db = new ONTAPEntities();

            db.Classes.Add(newClass);
            db.SaveChanges();
        }