private void InitListViewModel(RoleItemsViewModel viewModel, RoleItems list) { foreach (var item in viewModel.Items) { InitBaseItemViewModel(item); } }
public void SetRoleItems(IEnumerable <IdentityRole> roles) { foreach (var role in roles) { RoleItems.Add(new SelectListItem() { Value = role.Id.ToString(), Text = role.Name }); } }
public ActionResult List(RoleFilterViewModel filterViewModel) { InitRoleFilterViewModel(ref filterViewModel, true); var filter = Mapper.Map <RoleFilter>(filterViewModel); RoleItems list = _roleRepository.GetRoleItems(UserContext.User.Id, UserContext.User.OrganizationId, filter); RoleItemsViewModel viewModel = Mapper.Map <RoleItemsViewModel>(list); viewModel.Filter = filterViewModel; InitListViewModel(viewModel, list); return(View(Mvc.View.Role.List, viewModel)); }
protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); var result = await Http.GetFromJsonAsync <PagedResultDto <UserDto> >("/api/base/user"); var roles = await GetRoleListAsync(); Items = result.Items; foreach (var role in roles) { RoleItems.Add(new SelectedItem { Text = role.Name, Value = role.Name }); } }