示例#1
0
        public Enrollment SetFirstEnrollment(int st, Student stu)
        {
            var db = new s14354Context();

            var en = db.Enrollment.Where(en => en.Semester == 1 && en.IdStudy == st).First();

            stu.IdEnrollment = en.IdEnrollment;
            db.Attach(stu);
            db.Entry(stu).State = EntityState.Added;
            db.SaveChanges();

            return(en);
        }
示例#2
0
        public bool UpdateStudent(string fname, string index)
        {
            var db = new s14354Context();

            var s = new Student
            {
                IndexNumber = index,
                FirstName   = fname
            };

            db.Attach(s);

            db.Entry(s).Property("FirstName").IsModified = true;
            db.SaveChanges();
            return(true);
        }