public void EditTeacher(Teacher entity)
 {
     this.db.Teachers.FirstOrDefault(t => t.Id == entity.Id).DeletedOn = entity.DeletedOn;
     this.db.Teachers.FirstOrDefault(t => t.Id == entity.Id).IsDeleted = entity.IsDeleted;
     this.db.Teachers.FirstOrDefault(t => t.Id == entity.Id).ModifiedOn = entity.ModifiedOn;
     this.db.SaveChanges();
 }
 public int RegistrateTeacher(Teacher teacher, string login, string password)
 {
     try
     {
         return Teacher.RegistrateTeacher(teacher, login, password);
     }
     catch(Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
Beispiel #3
0
        public static void Main()
        {
            var disciplines = GetDisciplines();
            var teacher = new Teacher("Ivaylo Kenov", disciplines);
            teacher.AddComment("The best one!");

            var student = new Student("Ivancho");
            Console.WriteLine(student.ID);

            var course = new Course("a");
            course.AddTeacher(teacher);
            course.AddStudent(student);
        }
 public List<StudingTheSubject> GetCurrentPair(DateTime date, Teacher teacher)
 {
     try
     {
         var tm = TimeTable.GetByTeacher(teacher);
         if (tm == null)
             return new List<StudingTheSubject>();
         var currentPairs = tm.GetPair(DateTime.Now);
         return currentPairs;
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
 public void CreateTeacher(Teacher entity)
 {
     this.db.Teachers.Add(entity);
     this.db.SaveChanges();
 }
 public void DeleteTeacher(Teacher entity)
 {
     entity.IsDeleted = true;
     entity.DeletedOn = DateTime.Now;
     this.db.SaveChanges();
 }
 public List<StudingTheSubject> GetNextPair(Teacher teacher, out DateTime date)
 {
     try
     {
         var tm = TimeTable.GetByTeacher(teacher);
         if (tm == null)
         {
             date = DateTime.Now;
             return new List<StudingTheSubject>();
         }
         var nextPairs = tm.GetNextPair(out date);
         return nextPairs;
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
 public List<StudingTheSubject> GetAllSdudingSubjects(Teacher teacher)
 {
     try
     {
         return TimeTable.GetAllPairs(teacher);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
 public bool IsTimeTableForTeacher(Teacher teacher)
 {
     try
     {
         if (TimeTable.GetByTeacher(teacher) == null)
             return false;
         return true;
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }