Versions Compared

Key

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

...

Example 1 - Storing metadata

Code Block
languagec#
// Provide some metadata that helps to describe this particular service request.
var metadata = new BusinessLineMetadata() {
    VesselManufacturer = "Princecraft",
    MIC = "CA-QJT",
    VesselYear = "2019"
};

// Create the service request artifact documents
await _documentManager.Create(document, metadata, document.DisplayNameEn, document.DisplayNameFr, MyDocumentVersion, serviceRequestId, CurrentUser.Id);

Example 2- Retrieving metadata on the dashboard

Code Block
languagec#
ICollection<ServiceRequest> serviceRequests = await _serviceRequestManager.Get<DTO.BusinessLineMetadata>(CurrentUser.Id, page, pageSize);

var dashboardViewModel = new MyRequestsViewModel
{
Requests = serviceRequests.Select(x =>
    {
        var serviceMetadata = (DTO.BusinessLineMetadata)x.Metadata;
        return new ServiceRequestViewModel()
        {
            VesselManufacturer= serviceMetadata.VesselManufacturer,
            MIC = serviceMetadata.MIC,
            VesselYear = serviceMetadata.VesselYear 
        };
    }).ToList()
};

return PartialView("MyRequests", dashboardViewModel);

...