public async Task <ETaskStatus> UpdateCouncillorsDetails(FosteringCaseCouncillorsUpdateModel model) { var builder = new FormFieldBuilder(); CreateCouncillorsDetailsIntegratedFormFields(builder, model.FirstApplicant.HasContactWithCouncillor ? model.FirstApplicant.CouncillorRelationshipDetails : new List <CouncillorRelationshipDetailsUpdateModel>()); CreateCouncillorsDetailsIntegratedFormFields(builder, model.SecondApplicant?.HasContactWithCouncillor != null && model.SecondApplicant.HasContactWithCouncillor ? model.SecondApplicant.CouncillorRelationshipDetails : new List <CouncillorRelationshipDetailsUpdateModel>(), true); builder .AddField("contactwithcouncillor1", model.FirstApplicant.HasContactWithCouncillor.ToString().ToLower()) .AddField("contactwithcouncillor2", model.SecondApplicant?.HasContactWithCouncillor.ToString().ToLower() ?? string.Empty) .AddField(EFosteringApplicationForm.CouncillorsOrEmployees.GetFormStatusFieldName(), ETaskStatus.Completed.GetTaskStatus()); var response = await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel { CaseReference = model.CaseReference, IntegrationFormFields = builder.Build(), IntegrationFormName = _applicationFormName }); if (response.StatusCode != HttpStatusCode.OK) { throw new Exception($"Application Service. UpdateCouncillorsDetails: Failed to update. Verint service response: {response}"); } return(ETaskStatus.Completed); }
public async Task <IActionResult> UpdateCouncillorsDetails(FosteringCaseCouncillorsUpdateModel model) { try { var response = await _applicationService.UpdateCouncillorsDetails(model); return(Ok(response)); } catch (Exception ex) { return(StatusCode(500, ex)); } }
public async Task UpdateCouncillorsDetails_ShouldCallApplicationService() { // Arrange var model = new FosteringCaseCouncillorsUpdateModel { CaseReference = "12345678" }; // Act await _application.UpdateCouncillorsDetails(model); // Assert _mockApplicationService.Verify(_ => _.UpdateCouncillorsDetails(model), Times.Once); }
public async Task <HttpResponse <ETaskStatus> > UpdateCouncillorsOrEmployees(FosteringCaseCouncillorsUpdateModel model) => await PatchAsync <ETaskStatus>($"{ApplicationEndpoint}/councillors-details", model);