Ejemplo n.º 1
0
        private DataResult <UserModel> GetUserByEmail(string email, LevelOfAssuranceEnum minLevelOfAssurance)
        {
            var formattedEmail = m_contactFormatterManager.FormatEmail(email);

            try
            {
                var user      = m_userUoW.GetUserByContact(formattedEmail, ContactTypeEnum.Email, minLevelOfAssurance);
                var viewModel = m_mapper.Map <UserModel>(user);

                return(Success(viewModel));
            }
            catch (NoResultException <UserEntity> e)
            {
                m_logger.LogWarning(e);
                return(Error <UserModel>(m_translator.Translate("invalid-email"), DataResultErrorCode.UserNotExistEmail));
            }
            catch (DatabaseException e)
            {
                m_logger.LogWarning(e);
                return(Error <UserModel>(e.Message));
            }
        }