Example #1
0
        public Class[] Getclass()
        {
            var db      = new ONTAPEntities();
            var classes = db.Classes.ToArray();

            return(classes);
        }
Example #2
0
        public Class GetClass(int id)
        {
            var db     = new ONTAPEntities();
            var @class = db.Classes.Find(id);

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

            db.Classes.Remove(@class);
            db.SaveChanges();
        }
Example #4
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 #5
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();
        }