Developer's Guide - EPiServer World
Developer's Guide - EPiServer World
Developer's Guide - EPiServer World
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
78 | Developer’s <strong>Guide</strong> <strong>EPiServer</strong> Community 3.1<br />
Get Answers Given by an Expert<br />
It is sometimes usefull to know all answers given by a specific Expert, regardless of a Question. The code below<br />
presents how to do that.<br />
// Get the expert by its ID<br />
ExpertBase expert = ExpertHandler.GetExpert(332);<br />
// Get the answers given by this expert (first page with 100<br />
// answers)<br />
AnswerCollection answers = ExpertHandler.GetAnswers(expert, 1, 100);<br />
Get an Answer Given by an Expert to a Question<br />
To get only the answer that an Expert submitted to a specific Question, you can use code similar to the one presented<br />
below.<br />
// Get the expert by its ID<br />
ExpertBase expert = ExpertHandler.GetExpert(332);<br />
// Get the question by its ID<br />
Question question = ExpertHandler.GetQuestion(323);<br />
// Get the answer given by this expert to this question<br />
Answer answer = ExpertHandler.GetAnswer(question, expert);<br />
© <strong>EPiServer</strong> AB