Exemple #1
0
        public ActionResult GetAstridUsers()
        {
            var model = new AdminViewModels.AdminViewModel();

            try
            {
                var adminUsers = _portalSosService.HamtaAdminUsers();
                var roller     = _portalSosService.HamtaAllaAstridRoller().ToList();
                model.AdminUsers = ConvertAdminUsersToViewModel(adminUsers, roller).ToList();
                //Skapa lista över astrid-roller
                model.Roller      = ConvertRolesToVM(roller);
                ViewBag.RolesList = CreateRolesDropDownList(roller);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                ErrorManager.WriteToErrorLog("AdminController", "GetAstridUsers", e.ToString(), e.HResult, User.Identity.Name);
                var errorModel = new CustomErrorPageModel
                {
                    Information  = "Ett fel inträffade vid hämtning av admin-användare",
                    ContactEmail = ConfigurationManager.AppSettings["ContactEmail"],
                };
                return(View("CustomError", errorModel));
            }
            return(View("Index", model));
        }