Esempio n. 1
0
        public AppUserData GetUserDataByAdLogin(string userNamePart)
        {
            AppUser user = AppUserRepository.GetSingle(x => x.Login == userNamePart);

            if (user == null)
            {
                return(null);
            }
            AppUserData result = new AppUserData()
            {
                Id              = user.Id,
                FirstName       = user.FirstName,
                LastName        = user.LastName,
                UserName        = user.Email,
                Functionalities = EnumHelpers.GetEnumList <FunctionalityType>(),
                Language        = user.Language.LanguageDictionary,
                Login           = user.Login,
                IsActive        = user.IsActive,
                Roles           = user.AppUserRoles.Select(x => x.AppRole.AppRoleType).ToList(),
            };

            return(result);
        }
Esempio n. 2
0
        public AppUserData GetFirstUser()
        {
            AppUser user = AppUserRepository.GetSingle(x => x.Email == "*****@*****.**");

            if (user == null)
            {
                user = AppUserRepository.GetAll(x => x.LastName != null && x.LastName != "").OrderBy(x => x.LastName).FirstOrDefault();
            }
            AppUserData result = new AppUserData()
            {
                Id              = user.Id,
                FirstName       = user.FirstName,
                LastName        = user.LastName,
                UserName        = user.Email,
                Functionalities = EnumHelpers.GetEnumList <FunctionalityType>(),
                Language        = user.Language.LanguageDictionary,
                Login           = user.Login,
                IsActive        = user.IsActive,
                //Roles = EnumHelpers.GetEnumList<AppRoleType>(),
                Roles = user.AppUserRoles.Select(x => x.AppRole.AppRoleType).ToList()
            };

            return(result);
        }