GroupFactoryFindById Method |
Find a group using his identifier, return null if not found
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static IGroup FindById(
IContext context,
int id
)
Public Shared Function FindById (
context As IContext,
id As Integer
) As IGroup
public:
static IGroup^ FindById(
IContext^ context,
int id
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Context of execution - id
- Type: SystemInt32
Id of the group to find
Return Value
Type:
IGroupReturn null if the group was not found
Examples
Find the group using his id
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
throw contextValidation.Exception;
}
var group = GroupFactory.FindById(context, context.User.Id);
if (group != null)
{
Console.WriteLine("Group Id={0} was found: {1}", group.Id, group.Name);
}
else
{
Console.WriteLine("The specified group was not found.");
}
See Also