예제 #1
0
        public async Task <IActionResult> Index()
        {
            //TournamentManager.Validators.UserEntityValidatorResource.Culture = CultureInfo.CurrentCulture;
            //var x = TournamentManager.EntityValidators.UserEntityValidatorResource.EmailMustBeSetAndValid;
            var ue = new TournamentManager.DAL.EntityClasses.UserEntity();

            ue.Fields[(int)TournamentManager.DAL.UserFieldIndex.UserName].Alias = _metaData.GetDisplayName <ChangeUsernameViewModel>(nameof(ChangeUsernameViewModel.Username));

            var user = await GetCurrentUserAsync();

            if (user == null)
            {
                return(RedirectToAction(nameof(Account.SignIn), nameof(Account), new { Organization = _siteContext.UrlSegmentValue }));
            }

            var model = new IndexViewModel(_timeZoneConverter)
            {
                ApplicationUser = user,
                HasPassword     = await _userManager.HasPasswordAsync(user),
                Logins          = await _userManager.GetLoginsAsync(user),
                ManageMessage   = TempData.Get <ManageMessage>(nameof(ManageMessage))
            };

            // Display phone numbers in the format of the current region
            model.ApplicationUser.PhoneNumber = _phoneNumberService.Format(model.ApplicationUser.PhoneNumber,
                                                                           _regionInfo.TwoLetterISORegionName);
            model.ApplicationUser.PhoneNumber2 = _phoneNumberService.Format(model.ApplicationUser.PhoneNumber2,
                                                                            _regionInfo.TwoLetterISORegionName);

            return(View(model));
        }