ToUser() публичный статический Метод

Intentionally doesn't populate the User.Password property (as this is only ever stored).
public static ToUser ( UserEntity entity ) : User
entity UserEntity
Результат User
Пример #1
0
        public User GetUserById(Guid id, bool?isActivated = null)
        {
            UserEntity entity;

            if (isActivated.HasValue)
            {
                entity = Users.FirstOrDefault(x => x.Id == id && x.IsActivated == isActivated);
            }
            else
            {
                entity = Users.FirstOrDefault(x => x.Id == id);
            }

            return(FromEntity.ToUser(entity));
        }
Пример #2
0
        public User GetUserByEmail(string email, bool?isActivated = null)
        {
            UserEntity entity;

            if (isActivated.HasValue)
            {
                entity = Users.FirstOrDefault(x => x.Email == email && x.IsActivated == isActivated);
            }
            else
            {
                entity = Users.FirstOrDefault(x => x.Email == email);
            }

            return(FromEntity.ToUser(entity));
        }
Пример #3
0
        public User SaveOrUpdateUser(User user)
        {
            UserEntity entity = UnitOfWork.FindById <UserEntity>(user.Id);

            if (entity == null)
            {
                // Turn the domain object into a database entity
                entity = new UserEntity();
                ToEntity.FromUser(user, entity);
                UnitOfWork.Add(entity);
                UnitOfWork.SaveChanges();

                user = FromEntity.ToUser(entity);
            }
            else
            {
                ToEntity.FromUser(user, entity);
                UnitOfWork.SaveChanges();
            }

            return(user);
        }
Пример #4
0
        public User GetUserByUsernameOrEmail(string username, string email)
        {
            UserEntity entity = Users.FirstOrDefault(x => x.Username == username || x.Email == email);

            return(FromEntity.ToUser(entity));
        }
Пример #5
0
        public User GetUserByUsername(string username)
        {
            UserEntity entity = Users.FirstOrDefault(x => x.Username == username);

            return(FromEntity.ToUser(entity));
        }
Пример #6
0
        public User GetUserByPasswordResetKey(string key)
        {
            UserEntity entity = Users.FirstOrDefault(x => x.PasswordResetKey == key);

            return(FromEntity.ToUser(entity));
        }
Пример #7
0
        public User GetEditorById(Guid id)
        {
            UserEntity entity = Users.FirstOrDefault(x => x.Id == id && x.IsEditor);

            return(FromEntity.ToUser(entity));
        }
Пример #8
0
        public User GetUserByActivationKey(string key)
        {
            UserEntity entity = Users.FirstOrDefault(x => x.ActivationKey == key && x.IsActivated == false);

            return(FromEntity.ToUser(entity));
        }
Пример #9
0
        public User GetUserByUsername(Guid id)
        {
            UserEntity entity = Users.FirstOrDefault(x => x.Id == id);

            return(FromEntity.ToUser(entity));
        }