ContextFactoryCreateForRegistration Method |
Creates a special restricted context of execution to register a user account.
Namespace: AskiaPortalCmn
This example shows how to create a context to register a new user account.
using system; using AskiaPortalCmn; namespace MyApp { class Program { static void Main(string[] args) { var context = ContextFactory.CreateForRegistration(); context.User.FirstName = "John"; context.User.LastName = "Doe"; context.User.Email = "johndoe@anonymous.com"; var saveResult = context.User.Save(); if (saveResult.Success) { Console.WriteLine("The account for the user `{0} {1}` was successfully created. An email has been sent to `{2}`", context.User.FirstName, context.User.LastName, context.User.Email); } else { Console.Error.WriteLine("Unable to create the user account"); Console.Error.Write(saveResult.Exception.Message); } } } }