Exemple #1
0
        public IEnumerable <Student> GetStudents()
        {
            var db       = new s14354Context();
            var students = db.Student.ToList();

            return(students);
        }
Exemple #2
0
        public void Promote(String study, int sem)
        {
            var db = new s14354Context();

            var students = db.Database.ExecuteSqlRaw("execute spPromote @study,@sem", study, sem);

            using (var con = new SqlConnection("Data Source=db-mssql;Initial Catalog=s14354;Integrated Security=True"))
                using (var com = new SqlCommand("spPromote", con));
        }
Exemple #3
0
        public bool DeleteStudent(string index)
        {
            var db = new s14354Context();
            var s  = new Student
            {
                IndexNumber = index
            };

            db.Attach(s);
            db.Remove(s);
            return(true);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }