public ActionResult <IEnumerable <string> > Get() { try { var folderpath = _config.GetSection("AddressPath").Value; var filePaths = Directory.GetFiles(folderpath, "*_*.csv"); foreach (var item in filePaths) { //extract file name var filename = Convert.ToString(filePaths.FirstOrDefault().Split('\\')[3].Split('.')[0]); //add key to hash match var dataFromCsv = _csvLoader.ProcessDataCsv(item); var dataForCache = _csvLoader.ProcessDataToDictionary(dataFromCsv); var datafromHash = _cacheRepo.ConvertDataForHash(dataForCache); //push to cache store db var result = _cacheRepo.PushHashBatchToRedis(datafromHash); //data pushed to redis as hash var dataForDocument = _cacheRepo.ConvertDataForDocument(dataForCache); //push to search index var resultforIndex = _cacheRepo.AddDataToIndex(_cacheDb, "addressIndex", dataForDocument); //once check } } catch (Exception ex) { throw ex; } return(new string[] { "value1", "value2" }); }