예제 #1
0
        private async Task InserirProfessorCursoGoogleAsync(ProfessorGoogle professorGoogle, CursoGoogle cursoGoogle, bool existeProfessorCursoLocal)
        {
            var professorCursoGoogle = new ProfessorCursoGoogle(professorGoogle.Indice, cursoGoogle.Id);

            try
            {
                var professorCursoSincronizado = !existeProfessorCursoLocal && await mediator.Send(new InserirProfessorCursoGoogleCommand(professorCursoGoogle, professorGoogle.Email));

                if (professorCursoSincronizado && !existeProfessorCursoLocal)
                {
                    await InserirProfessorCursoAsync(professorCursoGoogle);
                }
            }
            catch (GoogleApiException gEx)
            {
                if (gEx.EhErroDeDuplicidade())
                {
                    await InserirProfessorCursoAsync(professorCursoGoogle);
                }
                else
                {
                    throw;
                }
            }
        }
예제 #2
0
        private async Task IncluirProfessorCursoNoGoogle(ProfessorCursoGoogle professorCursoGoogle, string email, ClassroomService servicoClassroom)
        {
            var professorParaIncluirGoogle = new Teacher()
            {
                UserId = email
            };

            var requestCreate = servicoClassroom.Courses.Teachers.Create(professorParaIncluirGoogle, professorCursoGoogle.CursoId.ToString());
            await requestCreate.ExecuteAsync();
        }
 public InserirProfessorCursoGoogleCommand(ProfessorCursoGoogle professorCursoGoogle, string email)
 {
     ProfessorCursoGoogle = professorCursoGoogle;
     Email = email;
 }
예제 #4
0
 private async Task InserirProfessorCursoAsync(ProfessorCursoGoogle professorCursoGoogle)
 {
     professorCursoGoogle.Id = await mediator.Send(new IncluirCursoUsuarioCommand(professorCursoGoogle.UsuarioId, professorCursoGoogle.CursoId));
 }