Interface IClientService
Represents the client API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IClientService
Examples
_clientService = relativityFacade.Resolve<IClientService>();
Methods
| Improve this Doc View SourceCreate(Client)
Creates the specified client.
Declaration
Client Create(Client entity)
Parameters
Type | Name | Description |
---|---|---|
Client | entity | The Client to create. |
Returns
Type | Description |
---|---|
Client | The created client. |
Examples
Create any old client.
Client client = _clientService.Create(Client());
Create a client with specified properties.
Client client = new Client
{
Name = "TheBigClient",
Number = 12345,
Status = new NamedArtifact { Name = ClientStatus.Inactive.ToString() },
Keywords = "SomeKeyword"
Notes = "Some note about the client."
};
client = _clientService.Create(client);
|
Improve this Doc
View Source
Delete(Int32)
Deletes the Client by ID.
Declaration
void Delete(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ArtifactID of the client. |
Examples
_clientService.Delete(client.ArtifactID);
|
Improve this Doc
View Source
Get(Int32)
Gets the Client by ArtifactID.
Declaration
Client Get(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ArtifactID of the client. |
Returns
Type | Description |
---|---|
Client | The Client if it exists, else null. |
Examples
Client client = _clientService.Get(1234567);
|
Improve this Doc
View Source
Get(String)
Gets the Client by name.
Declaration
Client Get(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the client. |
Returns
Type | Description |
---|---|
Client | The Client if it exists, else null. |
Examples
Client client = _clientService.Get("AnotherClient");
|
Improve this Doc
View Source
GetEligibleStatuses()
Gets a list of available statuses for a Client.
Declaration
IEnumerable<NamedArtifact> GetEligibleStatuses()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<NamedArtifact> | List of of available statuses. |
Examples
IEnumerable<NamedArtifact> availableStatuses = _clientService.GetEligibleStatuses();
|
Improve this Doc
View Source
Require(Client)
Requires the specified client.
- If the [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of
entity
has a positive value, this gets the client by ID and returns it. - Else if the [Name](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.NamedArtifact.html#Relativity_Testing_Framework_Models_NamedArtifact_Name) property of
entity
has a value, this gets the client by name and returns it if it exists. - Otherwise this creates a new client using [ICreateStrategy<T>](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Strategies.ICreateStrategy-1.html).
Declaration
Client Require(Client entity)
Parameters
Type | Name | Description |
---|---|---|
Client | entity | The Client to require. |
Returns
Type | Description |
---|---|
Client | The already existing, or created Client. |
Examples
This example will search for a client with the ArtifactID "1234567".
If it is found, it will be returned.
If not, it will be created.
Client client = new Client
{
ArtifactID = 1234567
};
client = _clientService.Require(client);
This example will search for a client named "MyClient".
If one is found, it will be returned.
If not, it will be created.
Client client = new Client
{
Name = "MyClient"
};
client = _clientService.Require(client);
|
Improve this Doc
View Source
Update(Client)
Updates the specified Client.
Declaration
void Update(Client entity)
Parameters
Type | Name | Description |
---|---|---|
Client | entity | The Client model to use to update the existing client with. |
Examples
Client client = _clientService.Get("Some Client Name");
client.Keywords = "SampleKeywords";
_clientService.Update(client);