Esempio n. 1
0
        public bool StartClassroom(StartClassroomRequest request)
        {
            if (request == null)
            {
                return(false);
            }

            var classroomName  = request.ClassroomName;
            var appFileEntries = request.AppFileEntries;

            try
            {
                var teacherConnectionId = Context.ConnectionId;

                ClassroomRepository.AddOrUpdate(classroomName,
                                                teacherConnectionId, appFileEntries);

                // Notificar a los estudiantes del inicio de la clase
                Clients
                .Group(classroomName)
                .ClassroomHasStarted();

                Logger.LogInformation("Clase iniciada {Classroom}",
                                      classroomName);

                return(true);
            }
            catch (Exception ex) when(ex is not HubException)
            {
                Logger.LogError(ex,
                                "No fue posible iniciar la clase {Classroom}",
                                classroomName);

                return(false);
            }
        }