public async Task <bool> NotificationRegistrationAsync(ProfileRealm profile)
        {
            try
            {
                if (!this._pushNotificationPlatformSpecificService.IsPushNotificationEnabledByDevice())
                {
                    throw new DisabledPushByDeviceException().SetErrorCode <DisabledPushByDeviceException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 168);
                }
                string platform = this._pushNotificationHandler.Platform.ToString();
                NotificationMessageType notificationType = NotificationMessageType.All;
                string handle = this._pushNotificationHandler.Token;
                NotificationMessageSource notificationSource = NotificationMessageSource.Kreta;
                TokenData tokenData = this._secureStore.GetTokenData(profile.Id);
                if (tokenData.ExpiresAt <= DateTime.Now)
                {
                    tokenData = await((IAuthDbDataService)Mvx.get_IoCProvider().Resolve <IAuthDbDataService>()).RefreshToken(profile);
                }
                if (tokenData == null)
                {
                    return(false);
                }
                this._tokenInfoRepository.AddOrUpdate(new TokenInfoRealmMapper().To((Ekreta.Mobile.Core.Models.TokenInfo)JsonConvert.DeserializeObject <Ekreta.Mobile.Core.Models.TokenInfo>(TokenDecoder.Decode(tokenData.AccessToken))), (Action <TokenInfoRealm>)null);
                Ekreta.Mobile.Core.Models.PushNotification.PushSettings pushSettings = await this._globalMobileApi.NotificationRegistrationAsync(profile.TokenInfo.InstituteCode, profile.TokenInfo.InstituteUserId, profile.TokenInfo.TutelaryId, platform, handle, (UserRoles)profile.TokenInfo.Role, notificationSource, (int)notificationType, profile.Id);

                PushSettingsRealm pushSettingsRealm = new PushSettingsRealmMapper().To(pushSettings);
                if (pushSettingsRealm != null)
                {
                    this._pushSettingsRepository.AddOrUpdate(pushSettingsRealm, (Action <PushSettingsRealm>)(ps =>
                    {
                        ps.NotificationTypes = (int)notificationType;
                        ps.FirstTimePushRun  = true;
                        ps.UpdateEugyintezes = true;
                        ps.Token             = handle;
                    }));
                    this.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = pushSettingsRealm));
                }
                else if (profile.PushSettings != null)
                {
                    this.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings.FirstTimePushRun = true));
                }
                else
                {
                    this.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = new PushSettingsRealm()
                    {
                        FirstTimePushRun = true
                    }));
                }
                return(pushSettings != null);
            }
            catch (DisabledPushByDeviceException ex)
            {
                ex.SetErrorCode <DisabledPushByDeviceException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 243);
                throw;
            }
            catch (Exception ex)
            {
                CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, "ProfileDataService.NotificationRegistrationAsync", "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 75);
                return(false);
            }
        }
        public ProfileRealm GetProfile(
            string instituteCode,
            int instituteUserId,
            int roleId)
        {
            ProfileRealm activeProfile = this.GetActiveProfile();

            return(roleId != 2 ? this._profileRepository.Query().ToList <ProfileRealm>().FirstOrDefault <ProfileRealm>((Func <ProfileRealm, bool>)(x =>
            {
                ParameterExpression parameterExpression;
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method reference
                // ISSUE: method reference
                // ISSUE: field reference
                TokenInfoRealm tokenInfoRealm = this._tokenInfoRepository.Query().FirstOrDefault <TokenInfoRealm>(Expression.Lambda <Func <TokenInfoRealm, bool> >((Expression)Expression.AndAlso((Expression)Expression.OrElse(token.InstituteUserId == this.instituteUserId, (Expression)Expression.Equal(token.TutelaryId, (Expression)Expression.Call(this.instituteUserId, (MethodInfo)MethodBase.GetMethodFromHandle(__methodref(int.ToString)), Array.Empty <Expression>()))), (Expression)Expression.Equal((Expression)Expression.Convert((Expression)Expression.Property((Expression)parameterExpression, (MethodInfo)MethodBase.GetMethodFromHandle(__methodref(TokenInfoRealm.get_Role))), typeof(int)), (Expression)Expression.Field((Expression)Expression.Constant((object)this, typeof(ProfileDbDataService.\u003C\u003Ec__DisplayClass14_0)), FieldInfo.GetFieldFromHandle(__fieldref(ProfileDbDataService.\u003C\u003Ec__DisplayClass14_0.roleId))))), parameterExpression));
                InstituteRealm instituteRealm = (InstituteRealm)RealmDb.Instance.Find <InstituteRealm>(instituteCode);
                return tokenInfoRealm != null && x.Institute == instituteRealm && x.TokenInfo == tokenInfoRealm;
            })) : (activeProfile.TokenInfo.InstituteUserId == instituteUserId ? activeProfile : this._profileRepository.Query().ToList <ProfileRealm>().FirstOrDefault <ProfileRealm>((Func <ProfileRealm, bool>)(x =>
            {
                ParameterExpression parameterExpression;
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method reference
                TokenInfoRealm tokenInfoRealm = this._tokenInfoRepository.Query().FirstOrDefault <TokenInfoRealm>(Expression.Lambda <Func <TokenInfoRealm, bool> >((Expression)Expression.OrElse(token.InstituteUserId == this.instituteUserId, (Expression)Expression.Equal(token.TutelaryId, (Expression)Expression.Call(this.instituteUserId, (MethodInfo)MethodBase.GetMethodFromHandle(__methodref(int.ToString)), Array.Empty <Expression>()))), parameterExpression));
                InstituteRealm instituteRealm = (InstituteRealm)RealmDb.Instance.Find <InstituteRealm>(instituteCode);
                return tokenInfoRealm != null && x.Institute == instituteRealm && x.TokenInfo == tokenInfoRealm;
            }))));
        }
        public void UpdateTokenData(ProfileRealm profile, TokenData tokenData)
        {
            TokenInfoRealm tokenInfoRealm = (TokenInfoRealm)JsonConvert.DeserializeObject <TokenInfoRealm>(TokenDecoder.Decode(tokenData.AccessToken));

            profile.TokenInfo = tokenInfoRealm;
            this.AddOrUpdate(profile, (Action <ProfileRealm>)null);
            this._secureStore.SaveTokenData(profile.Id, tokenData);
        }
 public async Task DeleteStudentHomeWorkAsync(ProfileRealm profile, int id)
 {
     if (profile == null)
     {
         throw new ArgumentNullException(nameof(profile));
     }
     await this._mobileApi.DeleteTanuloHaziFeladatAsync(profile, id);
 }
Пример #5
0
 public void AddOrUpdate(ProfileRealm profile, StudentRealm student)
 {
     if (student == null)
     {
         return;
     }
     this._studentRepository.AddOrUpdate(student, (Action <StudentRealm>)(s => s.ProfileId = profile.RolelessId));
 }
Пример #6
0
 public async Task <IEnumerable <SubjectAverageRealm> > FetchSubjectAveragesAsync(
     ProfileRealm profile)
 {
     if (profile == null)
     {
         throw new ArgumentNullException(nameof(profile));
     }
     return(await this._dbMobileApi.GetSubjectAveragesAsync(profile, false));
 }
Пример #7
0
 public void DeleteProfile(ProfileRealm profile)
 {
     this._profileDataService.Delete(profile);
     if (!this.ShouldDeleteDataFromProfile(profile.RolelessId))
     {
         return;
     }
     this._absenceDataService.Delete(profile.RolelessId);
     this._noteDataService.Delete(profile.RolelessId);
 }
 public async Task <StudentHomeWorkRealm> FetchStudentHomeworkAsync(
     ProfileRealm profile,
     int id)
 {
     if (profile == null)
     {
         throw new ArgumentNullException(nameof(profile));
     }
     return(await this._mobileApi.GetTanuloHaziFeladatAsync(profile, id, true));
 }
 public async Task <IEnumerable <ExamRealm> > FetchExamsAsync(
     ProfileRealm profile,
     bool forceRefresh = false)
 {
     if (profile == null)
     {
         throw new ArgumentNullException(nameof(profile));
     }
     return(await this._mobileApi.GetExamsAsync(profile, new DateTime?(), new DateTime?(), forceRefresh));
 }
 public async Task <IEnumerable <StudentHomeWorkRealm> > FetchStudentHomeWorksAsync(
     ProfileRealm profile,
     int teacherHomeWorkId)
 {
     if (profile == null)
     {
         throw new ArgumentNullException(nameof(profile));
     }
     return(await this._mobileApi.GetTanuloHaziFeladatListaAsync(profile, teacherHomeWorkId, true));
 }
Пример #11
0
 public async Task <TeacherHomeWorkRealm> FetchTeacherHomeWorkAsync(
     ProfileRealm profile,
     int id,
     bool forceRefresh = false)
 {
     if (profile == null)
     {
         throw new ArgumentNullException(nameof(profile));
     }
     return(await this._mobileApi.GetTanarHaziFeladatAsync(profile, id, forceRefresh));
 }
        public void SetActiveProfile(ProfileRealm profile)
        {
            IEnumerable <ProfileRealm> profiles = this.GetProfiles();

            this._profileRepository.AddOrUpdate(profiles, (Action <ProfileRealm>)(p => p.IsActive = p.Id == profile.Id));
            if (profiles.Any <ProfileRealm>((Func <ProfileRealm, bool>)(x => x.PushSettings != null && x.PushSettings.IsPushActive)) && !this._pushNotificationPlatformSpecificService.IsPushNotificationEnabledByDevice())
            {
                Dialogs.ShowToast("Push_SubscribedNeedEnable");
            }
            this.DefaultPushRegistration().Wait(30000);
        }
 public AuthDbMessageHandler(
     IDbMobileApi mobileApi,
     ISecureStore secureStore,
     ProfileRealm profile,
     HttpMessageHandler handler)
     : base(handler)
 {
     this._mobileApi           = mobileApi;
     this._secureStore         = secureStore;
     this._profile             = profile;
     this._tokenInfoRepository = (ITokenInfoDbRepository)Mvx.get_IoCProvider().Resolve <ITokenInfoDbRepository>();
 }
        public void DeleteOnlyProfileData(ProfileRealm profile)
        {
            switch (profile.PushSettings?.RegistrationId)
            {
            case null:
                this._profileRepository.Remove(profile);
                break;

            default:
                this._pushSettingsRepository.Remove(profile.PushSettings);
                goto case null;
            }
        }
        public async Task <TanuloHaziFeladatCreateResponse> CreateStudentHomeWorkAsync(
            ProfileRealm profile,
            LessonRealm lesson,
            string text)
        {
            TanuloHaziFeladatCreateResponse result;

            try
            {
                if (profile == null)
                {
                    throw new ArgumentNullException(nameof(profile));
                }
                TaskAwaiter <TanuloHaziFeladatCreateResponse> awaiter = this._mobileApi.CreateTanuloHaziFeladatAsync(profile, lesson, text).GetAwaiter();
                if (!awaiter.IsCompleted)
                {
                    int num;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003E1__state = num = 0;
                    TaskAwaiter <TanuloHaziFeladatCreateResponse> taskAwaiter = awaiter;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <TanuloHaziFeladatCreateResponse>, StudentHomeWorkDbDataService.\u003CCreateStudentHomeWorkAsync\u003Ed__5>(ref awaiter, this);
                    return;
                }
                TanuloHaziFeladatCreateResponse newHomeWork = awaiter.GetResult();
                if (!lesson.TeacherHomeWorkId.HasValue)
                {
                    this._lessonDataService.AddOrUpdate(lesson, (Action <LessonRealm>)(l => l.TeacherHomeWorkId = new int?(newHomeWork.TanarHaziFeladatId)));
                }
                result = newHomeWork;
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult(result);
        }
        public void Delete(ProfileRealm profile)
        {
            ((ICredentialsDataService)Mvx.get_IoCProvider().Resolve <ICredentialsDataService>()).DeleteCredentialByProfileId(profile.Id);
            this._tokenInfoRepository.Remove(profile.TokenInfo);
            switch (profile.PushSettings?.RegistrationId)
            {
            case null:
                this._profileRepository.Remove(profile);
                break;

            default:
                this._pushSettingsRepository.Remove(profile.PushSettings);
                goto case null;
            }
        }
Пример #17
0
        private ProfileRealm ProcessValidToken(
            InstituteRealm institute,
            TokenData tokenData,
            TokenInfoRealm tokenInfo)
        {
            ProfileRealm profile = this._profileDataService.GetProfile(this._tokenValidator.GetProfileIdFromTokenData(tokenInfo)) ?? this.CreateNewProfile(institute, tokenInfo);

            this._profileDataService.UpdateTokenData(profile, tokenData);
            if (profile == null)
            {
                throw new LoginException("Can't create profile. Profile was null in ProcessValidToken(TokenData)").SetErrorCode <LoginException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/Login/AuthDbDataService.cs", 232);
            }
            this._profileDataService.SetActiveProfile(profile);
            return(profile);
        }
        public async Task <bool> NotificationUpdateAsync(
            ProfileRealm profile,
            NotificationMessageType notificationType,
            string token)
        {
            try
            {
                Ekreta.Mobile.Core.Models.PushNotification.PushSettings pushSettings = await this._globalMobileApi.NotificationUpdateAsync(profile.PushSettings.RegistrationId, (int)notificationType, NotificationMessageSource.Kreta, token);

                profile.PushSettings.NotificationTypes = (int)notificationType;
                profile.PushSettings.Token             = token;
                this.AddOrUpdate(profile, (Action <ProfileRealm>)null);
                return(true);
            }
            catch (Exception ex)
            {
                CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, nameof(NotificationUpdateAsync), "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 269);
                return(false);
            }
        }
 public void AddOrUpdate(ProfileRealm profile, Action <ProfileRealm> action = null)
 {
     this._profileRepository.AddOrUpdate(profile, action);
 }
 public RefreshTokenDbException(string message, ProfileRealm profile)
     : base(message)
 {
     this.Profile = profile;
 }
Пример #21
0
 public void AddNewProfile(ProfileRealm profile)
 {
     this._profileDataService.AddOrUpdate(profile, (Action <ProfileRealm>)null);
 }
        public async Task <bool> NotificationDeleteAsync(
            ProfileRealm profile,
            bool useGlobalMobileApiV1 = false)
        {
            bool result;

            try
            {
                if (profile == null)
                {
                    throw new ArgumentNullException(nameof(profile));
                }
                PushSettingsRealm pushSettingsRealm = (PushSettingsRealm)null;
                try
                {
                    TaskAwaiter <Ekreta.Mobile.Core.Models.PushNotification.PushSettings> awaiter = this._globalMobileApi.NotificationDeleteAsync(profile?.PushSettings?.RegistrationId, NotificationMessageSource.Kreta, useGlobalMobileApiV1).GetAwaiter();
                    if (!awaiter.IsCompleted)
                    {
                        int num;
                        // ISSUE: explicit reference operation
                        // ISSUE: reference to a compiler-generated field
                        (^ this).\u003C\u003E1__state = num = 0;
                        TaskAwaiter <Ekreta.Mobile.Core.Models.PushNotification.PushSettings> taskAwaiter = awaiter;
                        // ISSUE: explicit reference operation
                        // ISSUE: reference to a compiler-generated field
                        (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <Ekreta.Mobile.Core.Models.PushNotification.PushSettings>, ProfileDbDataService.\u003CNotificationDeleteAsync\u003Ed__23>(ref awaiter, this);
                        return;
                    }
                    pushSettingsRealm = new PushSettingsRealmMapper().To(awaiter.GetResult());
                }
                catch (KeyNotFoundException ex)
                {
                    this._profileRepository.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = (PushSettingsRealm)null));
                    pushSettingsRealm = new PushSettingsRealm();
                }
                if (pushSettingsRealm != null)
                {
                    this._pushSettingsRepository.AddOrUpdate(pushSettingsRealm, (Action <PushSettingsRealm>)(ps =>
                    {
                        ps.FirstTimePushRun  = true;
                        ps.UpdateEugyintezes = true;
                    }));
                    this._profileRepository.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = pushSettingsRealm));
                }
                result = pushSettingsRealm != null;
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult(result);
        }
Пример #23
0
        public async Task <TokenData> RefreshToken(ProfileRealm profile)
        {
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            int       num1 = (^ this).\u003C\u003E1__state;
            TokenData storedTokenData;
            TokenData tokenData;
            TokenData result;

            try
            {
                storedTokenData = this._secureStore.GetTokenData(profile.Id);
                AuthDbDataService.refreshThrottleCounters.AddOrUpdate(profile.Id, 1, (Func <string, int, int>)((key, oldValue) => oldValue++));
                TaskAwaiter awaiter1 = this._semaphore.WaitAsync().GetAwaiter();
                if (!awaiter1.IsCompleted)
                {
                    int num2;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003E1__state = num2 = 0;
                    TaskAwaiter taskAwaiter = awaiter1;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, AuthDbDataService.\u003CRefreshToken\u003Ed__25>(ref awaiter1, this);
                    return;
                }
                awaiter1.GetResult();
                tokenData = (TokenData)null;
                try
                {
                    if (AuthDbDataService.refreshThrottleCounters[profile.Id] > 1 && storedTokenData != null)
                    {
                        tokenData = storedTokenData;
                    }
                    else
                    {
                        TaskAwaiter <TokenData> awaiter2 = this._mobileApi.RefreshTokenAsync(profile.Institute.Url, storedTokenData?.RefreshToken).GetAwaiter();
                        if (!awaiter2.IsCompleted)
                        {
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003E1__state = num1 = 1;
                            TaskAwaiter <TokenData> taskAwaiter = awaiter2;
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <TokenData>, AuthDbDataService.\u003CRefreshToken\u003Ed__25>(ref awaiter2, this);
                            return;
                        }
                        tokenData = awaiter2.GetResult();
                        this._secureStore.SaveTokenData(profile.Id, tokenData);
                    }
                }
                catch (RefreshTokenDbException ex)
                {
                    ex.SetErrorCode <RefreshTokenDbException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/Login/AuthDbDataService.cs", 189);
                    ex.Profile = profile;
                    ErrorHandler.Current.HandleError((Exception)ex);
                }
                finally
                {
                    if (num1 < 0)
                    {
                        int num2 = AuthDbDataService.refreshThrottleCounters[profile.Id]--;
                        if (AuthDbDataService.refreshThrottleCounters[profile.Id] == 0)
                        {
                            AuthDbDataService.refreshThrottleCounters.TryRemove(profile.Id, out num2);
                        }
                        this._semaphore.Release();
                    }
                }
                result = tokenData;
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                storedTokenData = (TokenData)null;
                tokenData       = (TokenData)null;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            storedTokenData = (TokenData)null;
            tokenData       = (TokenData)null;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult(result);
        }
 public async Task AddOrUpdateAsync(ProfileRealm profile, Action <ProfileRealm> action = null)
 {
     await this._profileRepository.AddOrUpdateAsync(profile, action);
 }
Пример #25
0
        private async Task InitStudentHomeWorks(LessonRealm lesson)
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel = this;
            LessonRealm lessonRealm = lesson;
            int?        teacherHomeWorkId1;
            int         num;

            if (lessonRealm == null)
            {
                num = 0;
            }
            else
            {
                teacherHomeWorkId1 = lessonRealm.TeacherHomeWorkId;
                num = teacherHomeWorkId1.HasValue ? 1 : 0;
            }
            if (num != 0)
            {
                try
                {
                    studentDetailViewModel.IsHomeWorkLoading = true;
                    studentDetailViewModel.IsOffline         = false;
                    if (!studentDetailViewModel._connectivity.get_IsConnected())
                    {
                        throw new NoInternetConnectionException().SetErrorCode <NoInternetConnectionException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", 166);
                    }
                    IStudentHomeWorkDbDataService homeWorkDataService1 = studentDetailViewModel._studentHomeWorkDataService;
                    ProfileRealm activeProfileRealm = studentDetailViewModel.ActiveProfileRealm;
                    teacherHomeWorkId1 = lesson.TeacherHomeWorkId;
                    int teacherHomeWorkId2 = teacherHomeWorkId1.Value;
                    IEnumerable <StudentHomeWorkRealm> homeWork = await homeWorkDataService1.FetchStudentHomeWorksAsync(activeProfileRealm, teacherHomeWorkId2);

                    IStudentHomeWorkDbDataService homeWorkDataService2 = studentDetailViewModel._studentHomeWorkDataService;
                    string rolelessId = studentDetailViewModel.ActiveProfileRealm.RolelessId;
                    teacherHomeWorkId1 = lesson.TeacherHomeWorkId;
                    int teacherHomeWorkId3 = teacherHomeWorkId1.Value;
                    IEnumerable <StudentHomeWorkRealm> studentHomeWorks = homeWork;
                    homeWorkDataService2.OverrideStudentHomeWorks(rolelessId, teacherHomeWorkId3, studentHomeWorks);
                    studentDetailViewModel.Homeworks = studentDetailViewModel.UpdateHomeWorksList(homeWork);
                }
                catch (Exception ex)
                {
                    ex.SetErrorCode <Exception>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", 175);
                    switch (ex)
                    {
                    case NoInternetConnectionException _:
                    case ServerUnreachableException _:
                        studentDetailViewModel.IsOffline = true;
                        studentDetailViewModel.ReloadHomeWorksFromDatabase();
                        break;
                    }
                }
                finally
                {
                    // ISSUE: reference to a compiler-generated method
                    ((MvxMainThreadDispatchingObject)studentDetailViewModel).InvokeOnMainThread(new Action(studentDetailViewModel.\u003CInitStudentHomeWorks\u003Eb__29_0), true);
                }
            }
            else
            {
                studentDetailViewModel.Homeworks = new List <StudentHomeWorkRealm>();
            }
        }