31.10.2014 Views

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tutorials | 47<br />

2.12.2 Removing a Club<br />

Removing a club can be done either temporarily or permanently. As with users, a permanent removal means there is no<br />

way of undoing the action, while a temporary removal only results in the club not appearing in listings and search<br />

queries.<br />

Importing Necessary Namespaces<br />

First import the necessary namespaces that will be used to remove a club. The namespace<br />

StarCommunity.Modules.Club is described by clicking on its name. Make sure you add the assembly as a reference,<br />

mentioned in section 1.1.1.<br />

using StarCommunity.Modules.Club;<br />

Removing a Club<br />

To temporarily remove a club get the Club object instance id, and send it as a parameter to the RemoveClub method.<br />

If we would now try to get the Club object instance with the GetClub method, the club’s Removed property would be<br />

set to true.<br />

//Get the club by id<br />

Club club = ClubHandler.GetClub(1234);<br />

//Temporarily remove the club<br />

ClubHandler.RemoveClub(club);<br />

Permanently Removing a Club<br />

To permanently remove a club we start off in the same way as we did with temporary removal. The difference is when<br />

we call the RemoveClub method, since this time we pass the permanent parameter as true. If you try to retrieve the<br />

Club object instance now, using the GetClub method, it will return null since the club no longer exists in the database.<br />

//Get the club by id<br />

Club club = ClubHandler.GetClub(1234);<br />

//Permanently remove the club<br />

ClubHandler.RemoveClub(club, true);<br />

2.12.3 Adding Club Members<br />

Becoming a member of a club is necessary if you want to share its information. A club owner does not have to go<br />

through the process of becoming a member after creating a club, since owners are automatically added to the<br />

member’s list.<br />

This article will show you, the developer, how to add a user as a member of a club and what the different results will be<br />

if the club is closed or open.<br />

© <strong>EPiServer</strong> AB

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!