public Task <RecordCollateralAssetAdministrativePlanResponse> RecordCollateralAssetAdministrativePlanAsync(string cr_reference_id, RecordCollateralAssetAdministrativePlanRequest body) { return(Task.Run <RecordCollateralAssetAdministrativePlanResponse>(() => { var collateral = new CdsEntity(); if (Guid.TryParse(cr_reference_id, out Guid collateralId) == false) { throw new Exception(_invalidCrReferenceIdError); } else { collateral.Id = collateralId; } if (string.IsNullOrEmpty(body.EmpolyeeBusinessUnitReference) == false) { if (Guid.TryParse(body.EmpolyeeBusinessUnitReference, out var businessUnitId) == false) { throw new Exception("EmpolyeeBusinessUnitReference must be specified as a valid GUID"); } else { var businessUnit = _cdsWebApi.Retrieve("businessunits", businessUnitId, "name"); collateral.Attributes["msfsi_evaluatedby"] = $"{businessUnit.Attributes["name"]} Team"; } } if (string.IsNullOrEmpty(body.RecordingRecordDateTime) == false) { if (DateTime.TryParse(body.RecordingRecordDateTime, out var recordingDateTime) == false) { throw new Exception("RecordingRecordDateTime must be specified as a valid DateTime"); } else { collateral.Attributes["msfsi_dateofvaluation"] = recordingDateTime; collateral.Attributes["msfsi_nextdateofvaluation"] = recordingDateTime.AddYears(1); } } if (string.IsNullOrEmpty(body.RecordingRecordType) == false) { collateral.Attributes["msfsi_description"] = body.RecordingRecordType; } if (collateral.Attributes.Count > 0) { _cdsWebApi.Update("msfsi_collaterals", collateral); } return new RecordCollateralAssetAdministrativePlanResponse() { RecordingRecordReference = collateral.Id.ToString(), RecordingRecordStatus = "Applied" }; })); }
public Task TerminateConsumerLoanFulfillmentArrangementAsync(string cr_reference_id) { return(Task.Run(() => { var loanId = ParseGuid(cr_reference_id, "cr_reference_id"); _cdsWebApi.Update("msfsi_financialproducts", new CdsEntity() { Id = loanId, Attributes = { ["statecode"] = 1, ["statuscode"] = -1 } }); })); }