예제 #1
0
        public void AddTutor(TutoringSession ts)
        {
            if (ts != null)
            {
                TutorTutoringSession tmptts = new TutorTutoringSession(selectedTutor, ts);
                try
                {
                    TutoringSessionUpdateDTO updateDTO = new TutoringSessionUpdateDTO(ts, ts);

                    ts.Tutors.Add(tmptts);
                    selectedTutor.TutoringSessions.Add(tmptts);

                    dal.UpdateTutoringSession(updateDTO);

                    Status = "Added to planned sessions";
                }
                catch (Exception ex)
                {
                    // Rollback
                    ts.Tutors.Remove(tmptts);
                    selectedTutor.TutoringSessions.Remove(tmptts);
                    Status = ExceptionHandler.GetErrorMessage(ex);
                }
                NotifyPropertyChanged("TutorTutoredHours");
                NotifyPropertyChanged("TutorPlannedHours");
                NotifyPropertyChanged("TutorLastSession");
                NotifyPropertyChanged("TutorNextSession");
                NotifyPropertyChanged("AvailableTutoringSessions");
                NotifyPropertyChanged("PlannedTutoringSessions");
            }
        }
예제 #2
0
파일: DAL.cs 프로젝트: jerterius/LabManager
 public bool Exists(TutorTutoringSession tts)
 {
     using (var context = new LabManagerDbContext())
     {
         return(context.TutorTutoringSession.Any(x => x.Equals(tts)));
     }
 }