Exemple #1
0
 public bool CreateInstructorAvailability(InstructorAvailability availability, string userId)
 {
     try
     {
         var instructor = Instructors.FindById(availability.InstructorId);
         if (availability.From < availability.To)
         {
             availability.UserCreated = userId;
             instructor.Availabilities.Add(availability);
         }
         Instructors.Update(instructor);
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Exemple #2
0
 public bool CreateInstructorAvailability(ICollection <InstructorAvailability> availabilities, string userId)
 {
     try
     {
         if (availabilities.Any())
         {
             var instructor = Instructors.FindById(availabilities.FirstOrDefault().InstructorId);
             foreach (var availability in availabilities)
             {
                 if (availability.From < availability.To)
                 {
                     availability.UserCreated = userId;
                     instructor.Availabilities.Add(availability);
                 }
             }
             Instructors.Update(instructor);
             return(true);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }