Click or drag to resize

AgentFactoryCreate Method

Creates a fresh new instance of agent.

Namespace:  AskiaFieldCom
Assembly:  AskiaFieldCom (in AskiaFieldCom.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static IResult<IAgent> Create(
	IContext context
)

Parameters

context
Type: AskiaFieldComIContext
Specified the context of execution.

Return Value

Type: IResultIAgent
Returns a fresh new instance of agent.
Remarks
This instance only exist in memory until you explicitly call the Save method.
Examples

Create a new agent.

var agent = AgentFactory.Create(context);
agent.FirstName = "John";
agent.LastName = "Doe";
agent.EmailAddress = "johndoe@anonymous.com";
var result = agent.Save();
if (!result.Success) throw result.Exception;
Console.WriteLine($"Agent created with the id {agent.Id}");
See Also