Ejemplo n.º 1
0
 void GetAllSelections()
 {
     Selections.Clear();
     foreach (var role in RoleVMs)
     {
         if (role.Checked)
         {
             Selections.Add(role.Name);
         }
     }
     UserVM.Roles = Selections.ToArray();
 }
Ejemplo n.º 2
0
        protected override async Task OnInitializedAsync()
        {
            ProfilePic = "images/no-photo.jpg";

            User = await CustomerService.GetUserAsync(CurrentUserInfo.CurrentUser.Id);

            Mapper.Map <AppUser, UserEditViewModel>(User, Profile);

            Selections = await CustomerService.GetUserRolesAsync(CurrentUserInfo.CurrentUser.Id);

            Profile.Roles = Selections.ToArray();
            if (!string.IsNullOrEmpty(CurrentUserInfo.CurrentUser.Photo))
            {
                ProfilePic = PictureExtensions.ImagePath($"{CurrentUserInfo.CurrentUser.Photo}", "i", DateTime.Now);
            }
            ProfileContext = new EditContext(Profile);
            ProfileContext.OnFieldChanged += HandleFieldChanged;
        }
Ejemplo n.º 3
0
        protected override async Task OnInitializedAsync()
        {
            Profile = await CustomerService.GetUserAsync();

            Selections = await CustomerService.GetUserRolesAsync(CurrentUserInfo.CurrentUser.Id);

            Profile.Roles = Selections.ToArray();

            Languages = (await LanguageService.GetAsync()).OrderBy(l => l.Id).ToList();
            if (!string.IsNullOrEmpty(Profile.Configuration))
            {
                Configuration   = JsonSerializer.Deserialize <UserConfiguration>(Profile.Configuration);
                IsDefaultParams = ObjectComparer.Equals(new UserConfiguration(), JsonSerializer.Deserialize <UserConfiguration>(Profile.Configuration));
            }

            ProfileContext = new EditContext(Profile);
            ProfileContext.OnFieldChanged       += ProfileHandleFieldChanged;
            ConfigurationContext                 = new EditContext(Configuration);
            ConfigurationContext.OnFieldChanged += HandleFieldChanged;
            await base.OnInitializedAsync();
        }