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.
70 | Developer’s <strong>Guide</strong> <strong>EPiServer</strong> Community 3.1<br />
2.18 Expert<br />
<strong>EPiServer</strong> Community Expert module provides functionality enabling users to ask questions that can be answered by the<br />
domain experts. Experts do not have to be community members to provide answers to the questions.<br />
2.18.1 Add an Expert<br />
To fully use the Expert functionality, at least one Expert has to be added to the community to answer the questions. In<br />
this section, we will focus on adding an Expert that is not a community member – its only job in the community is to<br />
answer questions.<br />
Import Necessary Namespaces<br />
First, import the necessary namespaces that will be used to add an expert. The namespaces StarSuite.Core, and<br />
StarCommunity.Modules.Expert are described by clicking on their respective names. Make sure you add the assembly as<br />
a reference, mentioned in 1.1.1.<br />
using StarSuite.Core;<br />
using StarCommunity.Modules.Expert;<br />
Create a New Expert<br />
Creating a new expert is a simple call to the Expert class constructor. The Expert class constructor allows for providing<br />
several properties describing an expert: first and last name, e-mail address, general description, qualifications, home page,<br />
phone, status and assigned site within the community.<br />
When the Expert object has been created, it has to be committed to database using the AddExpert method of the<br />
ExpertHandler class object.<br />
// Get site that the expert will be assigned to<br />
StarSuite.Core.Modules.ISite site = StarSuite.Core.SiteHandler.GetSite(1);<br />
// create a new Expert<br />
ExpertBase expert = new Expert("John", "Doe", "john@doe.com",<br />
"Description", "Qualifications", "555-55-55",<br />
"http://johndoe.expert.com", ExpertStatus.Active, site);<br />
// save expert in the database<br />
expert = ExpertHandler.AddExpert(expert);<br />
© <strong>EPiServer</strong> AB