public async Task <IActionResult> MatchingRichiesteByRisIdList(string richid, string cliId, int[] richlistRisIdList)
        {
            try
            {
                var data = await _richiesteManager.GetMatchingRichiesteListByRisIdAsync(richid, cliId, richlistRisIdList);

                if (data == null)
                {
                    return(null);
                }

                // creating the azioni object passing the related details and description.
                var azioniDto = _utilityManager.GetAzioniDtoObject(User, "get", "mathing richieste");
                // logging the activity record by the user.
                await _azioniManager.AzioniInsert(azioniDto);

                return(Ok(data));
            }
            catch (Exception x)
            {
                // Code block of Exception handling and logging into log_operazione table.
                var errorObj = await _utilityManager.ReturnErrorObj(x, User, "Get Matching Richieste");

                // Returning the error object.
                return(BadRequest(errorObj));
            }
        }
        public async Task <ActionResult> LaunchMachineLearning(string richId, string clientId)
        {
            try
            {
                // Creating the empty list of ris_id
                List <int> risIdList = new List <int>();

                // Creating the custom object to pass as the body to call the API.
                LaunchMLBody launchMLBody = new LaunchMLBody
                {
                    // Initaiting the static value of id_model
                    id_model = "six_generations",
                    // Initaiting the static value of filter_level
                    candidates_filter_level = "cv inviati",
                    // Initaiting the static value of n_candidtates.
                    n_candidates = 100
                };

                // creating the object of HTTPClient.
                var client = new HttpClient();
                // Initiating the base address of the API where the API is hosted.
                client.BaseAddress = new Uri("http://192.168.1.135:5000/");


                var asssc = AppSettingsDto.HostName;
                var h     = AppSettingsDto.APIDomainName;

                client.BaseAddress = new Uri(AppSettingsDto.APIDomainName);

                // Converting the custom message bosy object to JSon object.
                string message = JsonConvert.SerializeObject(launchMLBody);

                // Declaring and initiating the request to call the API.
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "api/jobs/" + richId + "/rankings");
                // Initiating the post bosy into the content
                request.Content = new StringContent(message, Encoding.UTF8, "application/json");
                // Initiating the request header.
                request.Headers.Add("accept", "application/json");
                // Sending the API request
                HttpResponseMessage response = client.SendAsync(request).Result;  // Blocking call! Program will wait here until a response is received or a timeout occurs.

                using (HttpContent content = response.Content)
                {
                    // Retrieving and stroing the result of the API
                    var json = content.ReadAsStringAsync();
                    // Converting the retrieved result to JToken object.
                    var jToken = JToken.Parse(json.Result);
                    // Retreving the desired result portion from the whole returned result.
                    var resultObj = jToken[1].ToObject <RootObject>();

                    // Storing the ris_id list from the retrieved result.
                    var candidates = resultObj.candidates;
                    // Loop through the all ris_id of the retreived list.
                    foreach (var item in candidates)
                    {
                        // Adding the each ris_id to the earlier defined ris_id list.
                        risIdList.Add(Convert.ToInt32(item.ris_id));
                    }

                    // Sending data to match richieste
                    var data = await _richiesteManager.GetMatchingRichiesteListByRisIdAsync(richId, clientId, risIdList.ToArray());

                    if (data == null)
                    {
                        return(null);
                    }

                    // creating the azioni object passing the related details and description.
                    var azioniDto = _utilityManager.GetAzioniDtoObject(User, "get", "machine learning");
                    // logging the activity record by the user.
                    await _azioniManager.AzioniInsert(azioniDto);

                    return(Ok(data));
                }
            }
            catch (Exception x)
            {
                // Code block of Exception handling and logging into log_operazione table.
                var errorObj = await _utilityManager.ReturnErrorObj(x, User, "Launch Machine learning");

                // Returning the error object.
                return(BadRequest(errorObj));
            }
        }