Ejemplo n.º 1
0
        public async Task <PartialViewResult> MySettingsModal()
        {
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            var viewModel = new MySettingsViewModel(output);

            return(PartialView("_MySettingsModal", viewModel));
        }
Ejemplo n.º 2
0
        public async Task GetUserProfileForEdit_Test()
        {
            //Act
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            //Assert
            var currentUser = await GetCurrentUserAsync();

            output.Name.ShouldBe(currentUser.Name);
            output.Surname.ShouldBe(currentUser.Surname);
            output.EmailAddress.ShouldBe(currentUser.EmailAddress);
        }
Ejemplo n.º 3
0
        public async Task <PartialViewResult> MySettingsModal()
        {
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            var viewModel = ObjectMapper.Map <MySettingsViewModel>(output);

            viewModel.TimezoneItems = await _timingAppService.GetTimezoneComboboxItems(new GetTimezoneComboboxItemsInput
            {
                DefaultTimezoneScope = SettingScopes.User,
                SelectedTimezoneId   = output.Timezone
            });

            viewModel.SmsVerificationEnabled = await SettingManager.GetSettingValueAsync <bool>(AppSettings.UserManagement.SmsVerificationEnabled);

            return(PartialView("_MySettingsModal", viewModel));
        }
Ejemplo n.º 4
0
        public async Task <PartialViewResult> MySettingsModal()
        {
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            var timezoneItems = await _timingAppService.GetTimezoneComboboxItems(new GetTimezoneComboboxItemsInput
            {
                DefaultTimezoneScope = SettingScopes.User,
                SelectedTimezoneId   = output.Timezone
            });

            var viewModel = new MySettingsViewModel(output)
            {
                TimezoneItems = timezoneItems
            };

            return(PartialView("_MySettingsModal", viewModel));
        }
Ejemplo n.º 5
0
        public async Task <List <LocalIncident> > GetAllAsync()
        {
            try
            {
                var reports = new List <LocalIncident>();
                try
                {
                    var currentUser = await profileAppService.GetCurrentUserProfileForEdit();

                    var uploadedReports = await _incidentsAppService.GetIncidentByUserId(new EntityDto { Id = currentUser.Id });

                    if (uploadedReports?.Items != null)
                    {
                        foreach (var incidentsOutput in uploadedReports?.Items.Where(x =>
                                                                                     DbService.ReadAllItems().All(y => y.MobileDataId != x.Incident.MobileDataId)))
                        {
                            var localReport = MapLocalIncident(incidentsOutput);
                            DbService.CreateItem(localReport);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                foreach (var item in DbService.ReadAllItems().ToList())
                {
                    item.IsLocal = true;
                    reports.Add(item);
                }
                return(reports.OrderByDescending(x => x.Date).ToList());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Crashes.TrackError(e);
                return(null);
            }
        }