예제 #1
0
        private async void InitData()
        {
            try
            {
                if (!IsBusy)
                {
                    AdminInfoDto data = await _userService.GetAdminInfo();

                    if (data != null)
                    {
                        Ages    = GetElements(data.Age);
                        Tags    = GetElements(data.Tags);
                        Genders = GetElements(data.Genders);
                        Message = "@Techdencias #4Sessions";
                    }
                    else
                    {
                        Ages    = new ObservableCollection <SelectableElement <int> >();
                        Tags    = new ObservableCollection <SelectableElement <string> >();
                        Genders = new ObservableCollection <SelectableElement <string> >();
                    }
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #2
0
        public AdminInfoDto GetAdminInfo(BaseDto baseDto)
        {
            var result = new AdminInfoDto();
            var user   = ValidateUser(baseDto);

            if (user != null && user.IsAdmin)
            {
                result.Tags    = new List <string>(regPushRepository.GetTags());
                result.Age     = new List <int>(userRepository.GetAges());
                result.Genders = new List <string>(userRepository.GetGenders());
            }
            else
            {
                throw new UnauthorizedAccessException();
            }
            return(result);
        }
예제 #3
0
        public IActionResult GetAdminInfo([FromBody] BaseDto baseDto)
        {
            AdminInfoDto adminInfo = appServices.GetAdminInfo(baseDto);

            return(Ok(adminInfo));
        }