Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Update a document

Description

Updates an existing document.

Package Details

Interface

IDocumentManager

Syntax

Task Update<TDocument, TMetadata>(TDocument document, TMetadata metadata, string serviceRequestNameEnglish, string serviceRequestNameFrench, string documentVersion, int serviceRequestId, int userId);

Returns

Task

API Endpoint

Not applicable.

Example

Code Block
languagec#
public class MyServiceRequestData
{
     public string DisplayNameEn { get; set; }
     public string DisplayNameFr { get; set; }
     public string DataFieldA { get; set; }
}  

const int userId = 100;
const int serviceRequestId = 100;
// Provide some metadata that helps to describe this particular service request.
var metadata = new { MetaDataFieldA = "test" };
     
// Retrieve the service request document.
//This function accepets a generic parameter, it's not limited to MyServiceRequestData
const int serviceRequestId = 100;
var serviceRequest = await documentManager.Get<MyServiceRequestData>(serviceRequestId);

// Update the service request document with some new data.
serviceRequest.DataFieldA = "Test 123";

// Update the service request document.
await _documentManager.Update(serviceRequest, metadata, serviceRequest.DisplayNameEn, serviceRequest.DisplayNameFr, "1.1", serviceRequestId, userId);