public async Task <IActionResult> UpdateReferences(FosteringCaseReferenceUpdateModel model)
        {
            try
            {
                var response = await _applicationService.UpdateReferences(model);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
Ejemplo n.º 2
0
        public async Task <ETaskStatus> UpdateReferences(FosteringCaseReferenceUpdateModel model)
        {
            var formFields = new FormFieldBuilder()
                             .AddField("prffirstname", model.FamilyReference.FirstName)
                             .AddField("prflastname", model.FamilyReference.LastName)
                             .AddField("prfrelation", model.FamilyReference.RelationshipToYou)
                             .AddField("prfyears", model.FamilyReference.NumberOfYearsKnown)
                             .AddField("prfemail", model.FamilyReference.EmailAddress)
                             .AddField("prfcontact", model.FamilyReference.PhoneNumber)
                             .AddField("prf11firstname", model.FirstPersonalReference.FirstName)
                             .AddField("prf1lastname", model.FirstPersonalReference.LastName)
                             .AddField("prf1relation", model.FirstPersonalReference.RelationshipToYou)
                             .AddField("prf1years", model.FirstPersonalReference.NumberOfYearsKnown)
                             .AddField("prf1email", model.FirstPersonalReference.EmailAddress)
                             .AddField("prf1contact", model.FirstPersonalReference.PhoneNumber)
                             .AddField("prf2firstname", model.SecondPersonalReference.FirstName)
                             .AddField("prf2lastname", model.SecondPersonalReference.LastName)
                             .AddField("prf2relation", model.SecondPersonalReference.RelationshipToYou)
                             .AddField("prf2years", model.SecondPersonalReference.NumberOfYearsKnown)
                             .AddField("prf2email", model.SecondPersonalReference.EmailAddress)
                             .AddField("prf2contact", model.SecondPersonalReference.PhoneNumber)
                             .AddField(EFosteringApplicationForm.References.GetFormStatusFieldName(), ETaskStatus.Completed.GetTaskStatus())
                             .Build();

            formFields.AddRange(AddressMapper.MapToVerintAddress(model.FamilyReference.Address, "prfaddress",
                                                                 "prfplaceref", "prfpostcode"));

            formFields.AddRange(AddressMapper.MapToVerintAddress(model.FirstPersonalReference.Address, "prf1address",
                                                                 "prf1placeref", "prf1postcode"));

            formFields.AddRange(AddressMapper.MapToVerintAddress(model.SecondPersonalReference.Address, "prf2address",
                                                                 "prf2placeref", "prf2postcode"));

            var updateModel = new IntegrationFormFieldsUpdateModel
            {
                IntegrationFormName   = _applicationFormName,
                CaseReference         = model.CaseReference,
                IntegrationFormFields = formFields
            };

            var response = await _verintServiceGateway
                           .UpdateCaseIntegrationFormField(updateModel);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Update references failure");
            }

            return(ETaskStatus.Completed);
        }
 public async Task <HttpResponse <ETaskStatus> > UpdateReferences(FosteringCaseReferenceUpdateModel model)
 => await PatchAsync <ETaskStatus>($"{ApplicationEndpoint}/references", model);