예제 #1
0
        private async Task PopulateViewModel()
        {
            CurrentUser = await _userManager.FindByEmailAsync(User.Identity.Name);

            Organization          = _dataService.GetOrganizationById(CurrentUser.OrganizationID);
            OrganizationName      = Organization.OrganizationName;
            IsDefaultOrganization = Organization.IsDefaultOrganization;
            var deviceGroups = _dataService.GetDeviceGroups(User.Identity.Name).OrderBy(x => x.Name);

            DeviceGroups.AddRange(deviceGroups);
            DeviceGroupSelectItems.AddRange(DeviceGroups.Select(x => new SelectListItem(x.Name, x.ID)));

            Users = _dataService.GetAllUsers(User.Identity.Name)
                    .Select(x => new OrganizationUser()
            {
                ID       = x.Id,
                IsAdmin  = x.IsAdministrator,
                UserName = x.UserName
            }).ToList();

            Invites = _dataService.GetAllInviteLinks(User.Identity.Name).Select(x => new Invite()
            {
                ID          = x.ID,
                InvitedUser = x.InvitedUser,
                IsAdmin     = x.IsAdmin,
                DateSent    = x.DateSent
            }).ToList();
        }
예제 #2
0
        private void PopulateViewModel()
        {
            OrganizationName = DataService.GetOrganizationName(User.Identity.Name);
            var deviceGroups = DataService.GetDeviceGroups(User.Identity.Name).OrderBy(x => x.Name);

            DeviceGroups.AddRange(deviceGroups);
            DeviceGroupSelectItems.AddRange(DeviceGroups.Select(x => new SelectListItem(x.Name, x.ID)));

            Users = DataService.GetAllUsers(User.Identity.Name)
                    .Select(x => new OrganizationUser()
            {
                ID       = x.Id,
                IsAdmin  = x.IsAdministrator,
                UserName = x.UserName
            }).ToList();

            Invites = DataService.GetAllInviteLinks(User.Identity.Name).Select(x => new Invite()
            {
                ID          = x.ID,
                InvitedUser = x.InvitedUser,
                IsAdmin     = x.IsAdmin,
                DateSent    = x.DateSent
            }).ToList();
        }