Exemplo n.º 1
0
        public AskQuestion[] GetQuestions(String nickname, String password)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            var ids       = AskAFriend.GetAskQuestionIDs(Member.GetMemberViaNicknamePassword(nickname, password).MemberID);
            var idsLength = ids.Length;
            var result    = new AskQuestion[idsLength];

            for (var i = 0; i < idsLength; i++)
            {
                var question = AskAFriend.GetAskQuestion(ids[i]);
                if (question == null)
                {
                    throw new ArgumentException(String.Format(Resources.Argument_AskQuestionNotExist, ids[i]));
                }
                result[i] = CreateQuestion(question);
            }

            return(result);
        }
Exemplo n.º 2
0
        public AskQuestion GetQuestion(String nickname, String password, Int32 questionID)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            var member     = Member.GetMemberViaNicknamePassword(nickname, password);
            var askAFriend = AskAFriend.GetAskQuestion(questionID);

            if (askAFriend == null)
            {
                throw new ArgumentException(String.Format(Resources.Argument_AskQuestionNotExist, questionID));
            }

            return(CreateQuestion(askAFriend));
        }