Exemplo n.º 1
0
        public ActionResult UserRoles(string id)
        {
            ViewModels.Account.SelectableUserRoleViewModel viewModel;
            List<ViewModels.Account.SelectableUserRoleViewModel> rolesList;

            rolesList = new List<ViewModels.Account.SelectableUserRoleViewModel>();

            Roles.GetAllRoles().ToList().ForEach(x =>
            {
                bool a = Roles.IsUserInRole(id, x);
                viewModel = new ViewModels.Account.SelectableUserRoleViewModel()
                {
                    Username = id,
                    Rolename = x,
                    IsSelected = Roles.IsUserInRole(id, x)
                };

                rolesList.Add(viewModel);
            });

            return View(rolesList);
        }
Exemplo n.º 2
0
        public ActionResult UserRoles(string id)
        {
            ViewModels.Account.SelectableUserRoleViewModel        viewModel;
            List <ViewModels.Account.SelectableUserRoleViewModel> rolesList;

            rolesList = new List <ViewModels.Account.SelectableUserRoleViewModel>();

            Roles.GetAllRoles().ToList().ForEach(x =>
            {
                bool a    = Roles.IsUserInRole(id, x);
                viewModel = new ViewModels.Account.SelectableUserRoleViewModel()
                {
                    Username   = id,
                    Rolename   = x,
                    IsSelected = Roles.IsUserInRole(id, x)
                };

                rolesList.Add(viewModel);
            });

            return(View(rolesList));
        }