Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

In the following example, you'll see how to store business-line specific metadata with a service request, so it can be retrieved on the application dashboard.

Example 1 - Storing metadata

// 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

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);

  • No labels