Ejemplo n.º 1
0
        public bool DeleteStudent(string index)
        {
            var db = new s14354Context();
            var s  = new Student
            {
                IndexNumber = index
            };

            db.Attach(s);
            db.Remove(s);
            return(true);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }