private async Task seedDatbase() { sam = new Student() { StudentName = "sam" }; jim = new Student() { StudentName = "jim" }; await studentRepository.AddStudentAsync(sam); await studentRepository.AddStudentAsync(jim); samsNote = new Note() { Content = "sam's note" }; await studentRepository.AddUnsignedNoteAsync(sam, samsNote); var mathRoom = new ClassRoom() { ClassRoomName = "Math room" }; await classRepository.AddClassRoomAsync(mathRoom); jonathan = new Teacher() { TeacherName = "jonathan" }; await classRepository.AddTeacherAsync(jonathan); math1010 = new Course() { CourseName = "math 1010", TeacherId = jonathan.TeacherId }; await courseRepository.AddCourseAsync(math1010); mathClass = new ClassModel() { ClassName = "Math in the afternoon", ClassRoomId = mathRoom.ClassRoomId, TeacherId = jonathan.TeacherId }; await classRepository.AddClassAsync(mathClass); await classRepository.EnrollStudentAsync(sam.StudentId, mathClass.ClassId, math1010.CourseId); await classRepository.EnrollStudentAsync(jim.StudentId, mathClass.ClassId, math1010.CourseId); }
public void AddNote() { logger.LogInformation($"Adding new note"); if (String.IsNullOrEmpty(Note.Content)) { errorAlert = "Note cannot be Empty"; return; } Note.DateCreated = DateTime.Now; Note.NoteType = (NoteTypes)NoteType; var t = Task.Run(async() => { // if (IsAnonymousNote) // { await studentRepository.AddUnsignedNoteAsync(Student, Note); // } // else // { // await studentRepository.AddSignedNoteAsync(Student, Note, TeacherId); // } }); t.Wait(); errorAlert = ""; Note = new Note() { }; }