public IEnumerable <Student> GetStudents() { var db = new s14354Context(); var students = db.Student.ToList(); return(students); }
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)); }
public bool DeleteStudent(string index) { var db = new s14354Context(); var s = new Student { IndexNumber = index }; db.Attach(s); db.Remove(s); return(true); }
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); }
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); }