Beispiel #1
0
        public @class GetClass(int id)
        {
            @class cl = new @class();

            try
            {
                cl = db.classes.SingleOrDefault(x => x.id_class == id);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(cl);
        }
Beispiel #2
0
        public bool AddClass(string class_name, int id_grade, int id_speciality)
        {
            var cl = new @class();

            cl.class_name    = class_name;
            cl.id_grade      = id_grade;
            cl.id_speciality = id_speciality;
            try
            {
                db.classes.Add(cl);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
            return(true);
        }