Example #1
0
        public IActionResult DataUpload(IFormCollection formdata)
        {
            var dataFields   = formdata.Where(x => x.Key == "DataFields").Select(x => x.Value).First().ToString();
            var customField  = formdata.Where(x => x.Key == "CustomField").Select(x => x.Value).First().ToString();
            var dataMappings = formdata.Where(x => x.Key == "DataMapping").Select(x => x.Value).First().ToString();

            if (String.IsNullOrEmpty(customField))
            {
                BaseDataService dataService = new BaseDataService(_config);

                if (dataService.ValidateDataIntoStaging(dataFields))
                {
                    if (dataService.ApplyMappingsToStaging(dataMappings))
                    {
                        dataService.InsertintoOutputTable();
                    }
                }
            }
            else
            {
                CustomDataService dataService = new CustomDataService(_config);
                dataService.customSourceField = customField;
                dataService.ExtractionMethod  = ExtractFromCustomField;



                if (dataService.ValidateDataIntoStaging(dataFields))
                {
                    if (dataService.ApplyMappingsToStaging(dataMappings))
                    {
                        dataService.InsertintoOutputTable();
                    }
                }
            }
            return(View());
        }