public async Task <ETaskStatus> UpdateInterestInFostering(FosteringCaseInterestInFosteringUpdateModel model)
        {
            var completed     = !string.IsNullOrEmpty(model.ReasonsForFostering) && model.TypesOfFostering.Any();
            var currentStatus = completed
                ? ETaskStatus.Completed
                : ETaskStatus.NotCompleted;

            var formFields = new FormFieldBuilder()
                             .AddField("fiichildrenwithdisability", model.TypesOfFostering.Exists(_ => _.Equals("childrenWithDisability")) ? "ChildrenWithDisabilities" : string.Empty)
                             .AddField("fiirespite", model.TypesOfFostering.Exists(_ => _.Equals("respite")) ? "Respite" : string.Empty)
                             .AddField("fiishortterm", model.TypesOfFostering.Exists(_ => _.Equals("shortTerm")) ? "ShortTerm" : string.Empty)
                             .AddField("fiilongterm", model.TypesOfFostering.Exists(_ => _.Equals("longTerm")) ? "LongTerm" : string.Empty)
                             .AddField("fiiunsure", model.TypesOfFostering.Exists(_ => _.Equals("unsure")) ? "Unsure" : string.Empty)
                             .AddField("fiishortbreaks", model.TypesOfFostering.Exists(_ => _.Equals("shortBreaks")) ? "ShortBreaks" : string.Empty)
                             .AddField("reasonsforfosteringapplicant1", model.ReasonsForFostering ?? string.Empty)
                             .AddField("tellusaboutyourinterestinfosteringstatus", Enum.GetName(typeof(ETaskStatus), currentStatus))
                             .Build();

            await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel
            {
                CaseReference         = model.CaseReference,
                IntegrationFormName   = _integrationFormName,
                IntegrationFormFields = formFields
            });


            return(currentStatus);
        }
Пример #2
0
        public async Task <IActionResult> UpdateInterestInFostering(FosteringCaseInterestInFosteringUpdateModel model)
        {
            try
            {
                var response = await _homeVisitService.UpdateInterestInFostering(model);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
 public async Task <HttpResponse <ETaskStatus> > UpdateInterestInFostering(FosteringCaseInterestInFosteringUpdateModel model)
 => await PatchAsync <ETaskStatus>($"{HomeVisitEndpoint}/interest-in-fostering", model);