public void AddSubjectToListVM() { Subject subject = new Subject(); Student student = new Student(); StudentSubject studentSubjectMVM = new StudentSubject(); subject = CurrentSubjectMVM; student = CurrentStudentMVM; if (CurrentStudentMVM != null) { studentSubjectMVM.StudentId = student.Id; if (CurrentSubjectMVM != null) { studentSubjectMVM.SubjectId = subject.Id; } } studentSubjectMVM.Save(); ErrorsList = studentSubjectMVM.CurrentValidation.Errors.Select(x => new ErrorMessage() { Message = x }).ToList(); //Nou if (CurrentStudentMVM != null) { GetSubjectsToStudent(); } }
public void AddSubjectToListVM() { Subject subject = new Subject(); Student student = new Student(); StudentSubject studentSubjectMVM = new StudentSubject(); subject = CurrentSubjectMVM; student = CurrentStudentMVM; studentSubjectMVM.StudentId = student.Id; studentSubjectMVM.SubjectId = subject.Id; ManagementErrorMGVM = ""; SubjectsByStudentList = studentSubjectMVM.StudentBySubjects(studentSubjectMVM.StudentId); if (SubjectsByStudentList != null && SubjectsByStudentList.Any(x => x.SubjectId == subject.Id)) { ManagementErrorMGVM = "El alumno ya tiene la asignatura"; } else { var error = studentSubjectMVM.Save(); if (error.IsSuccess == false) { ManagementErrorMGVM = error.ToString(); } else { var repo = StudentSubject.DepCon.Resolve <IRepository <StudentSubject> >(); SubjectsByStudentList = studentSubjectMVM.StudentBySubjects(studentSubjectMVM.StudentId); } } }
private void AddSubjectToListVM() { Subject subject = new Subject(); Student student = new Student(); StudentSubject studentSubjectMVM = new StudentSubject(); subject = CurrentSubject; student = CurrentStudent; if (CurrentStudent != null) { studentSubjectMVM.StudentId = student.Id; if (CurrentSubject != null) { studentSubjectMVM.SubjectId = subject.Id; } GetSubjectsToStudent(); } else { MessageBox.Show("No existe este estudiante"); } studentSubjectMVM.Save(); }
public void AddStudentSubject() { var repo1 = Entity.DepCon.Resolve <IRepository <Student> >(); var stud = repo1.QueryAll().FirstOrDefault(); var repo2 = Entity.DepCon.Resolve <IRepository <Subject> >(); var subj = repo2.QueryAll().FirstOrDefault(); StudentSubject newStudent = new StudentSubject { StudentId = stud.Id, SubjectId = subj.Id }; var res_save = newStudent.Save(); stud.StudentSubject.Add(newStudent); var res_save1 = stud.Save(); if (res_save.IsSuccess && res_save1.IsSuccess) { GetStudentSubjects(); } }
public void AddStudentSubject() { if (SelectedSubject != null) { if (!string.IsNullOrEmpty(dniEntry)) { var repo = Entity.DepCon.Resolve <IRepository <Student> >(); var stud = repo.QueryAll().Where(x => x.Dni == dniEntry).FirstOrDefault(); StudentSubject newStudent = new StudentSubject { StudentId = stud.Id, SubjectId = SelectedSubject.Id }; var res_save = newStudent.Save(); if (res_save.IsSuccess) { if (!string.IsNullOrEmpty(dniEntry)) { GetSubjectsByStudent(); } } } } }