public void TestMethod() { var studentId = Guid.NewGuid(); var scoreId = Guid.NewGuid(); var student = new Student { Id = studentId, Name = "asdd by controller", Grade = Grade.MiddleSchool, Scores = new List<Score> { new Score { Id=scoreId,ScoreEnglish = 99,StudentId=studentId }, new Score { Id=Guid.NewGuid(),StudentId=studentId } }, StudentSchools = new List<StudentSchool> { new StudentSchool { School=new School { Id=Guid.NewGuid(), Name="ECNU", Address="SH" } }, new StudentSchool { School=new School { Id=Guid.NewGuid(), Name="JD", Address="AnHui" } } } }; var score = default(IEnumerable<Score>); var stu = default(IEnumerable<Student>); using (var ssaDbContext = new SSADbContext()) { var ss = ssaDbContext.Scores.Find(new Guid("e3757350-471f-4203-9dbb-8b673a514ae5")); ssaDbContext.Students.Add(student); ssaDbContext.Scores.AddRange(student.Scores); ssaDbContext.SaveChanges(); score = ssaDbContext.Scores.Where(s => s.Id == scoreId).ToList(); stu = ssaDbContext.Students.Where(s => s.Id == studentId).ToList(); } using (var ssaDbContext = new SSADbContext()) { score = ssaDbContext.Scores.Where(s => s.Id == scoreId).ToList(); stu = ssaDbContext.Students.Where(s => s.Id == studentId).ToList(); } }
public static List<CourseOffering> GetEnrolledCourses(Student student) { return student.CourseOfferings.ToList(); }
public void CreeazaSituatie(Student stu,Materia materia,Nota nota) { stu.Situatii.Add(new Situatie(materia,nota)); }
//private List<T> GetDistinctList<T>(Expression<Func<StudentAnswer>> predicate) where T : BaseEntity //{ // return _context.StudentAnswers.Select<T>(predicate).Distinct(); //} private void GetStudents() { var uniqueListOfStudents = _context.StudentAnswers.Select(s => s.UserId).Distinct(); // ReSharper disable once LoopCanBeConvertedToQuery foreach (var studentId in uniqueListOfStudents) { var generatedStudent = new Student { SourceId = studentId, Name = RandomNameGenerator.GetName() }; students.Add(generatedStudent); } _context.Students.AddRange(students); _context.SaveChanges(); }
public void CreeazaStudent(Student stu) { Studenti.Add(stu); }
public void AddStudent(Student student) { _students.Add(student); }