Description
Updates a collection regulated entity ids for a specified service request.
Package Details
Interface
IServiceRegulatedEntityManager
Syntax
Task<ICollection<ServiceRegulatedEntity>> Update(int serviceRequestId, ICollection<ServiceRegulatedEntity> serviceRegulatedEntities)
Returns
ICollection<ServiceRegulatedEntity>
API
PUT - /api/v1/regulated-entities
Parameters
Parameter | Description | Type |
---|---|---|
serviceRequestId | The service request id associated to the regulated entity. The service request must exist. | Query string |
serviceRegulatedEntities | A collection of service regulated entities. | Body |
Sample request body – This is a sample which updates the value(s) of the service request regulated entities.
Notes: Only the values should be modified. The ids are associated to service request regulated entity values.
You can get all of the ids and values from the GetAll.
[ { "Id": 1, "Value": "test 1 " }, { "Id": 2, "Value": "test 2" }, { "Id": 3, "Value": "test 3" }, { "Id": 4, "Value": "test 4" } ]
Returns
HTTP 200 - OK
Returns a list of service request regulated entity values with their ids.
Sample response body – Returns the added values.
[ { "Id": 1, "Value": "test 1 " }, { "Id": 2, "Value": "test 2" }, { "Id": 3, "Value": "test 3" }, { "Id": 4, "Value": "test 4" } ]
Example
Note: Make sure to use the proper ids from the GetAll function.
//Use your own service request id. const int serviceRequetId = 1234; var serviceRequestRegulatedEntities = await ServiceRegulatedEntityManager.GetAll(serviceRequestId); var regulatedEntities = new List<ServiceRegulatedEntity>(); foreach (var serviceRequestRegulatedEntity in serviceRequestRegulatedEntities) { regulatedEntities.Add(new ServiceRegulatedEntity { Id = serviceRequestRegulatedEntity.Id, Value = "Updated value" }); } var updated = await ServiceRegulatedEntityManager.Update(serviceRequestId, regulatedEntities);