Exemple #1
0
        public DataResult <UserModel> GetUserById(int userId)
        {
            try
            {
                var user      = m_userUoW.GetUserById(userId);
                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-user-id"), DataResultErrorCode.UserNotExistId));
            }
            catch (DatabaseException e)
            {
                m_logger.LogWarning(e);
                return(Error <UserModel>(e.Message));
            }
        }