public IActionResult Index() { // string xml = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"WikimediaExample.xml"); string csv = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Libro1.csv"); string xls = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Libro2.xlsx"); //string cadenaXML = ""; string cadenaXLS = ""; cadenaXLS = LeerXls(xls); //cadenaXML = LeerXml(xml); //Console.WriteLine(cadenaXML); CabecerasClass obj = new CabecerasClass(csv); string cadenaCSV = obj.direc; string[] valores; if (cadenaXLS == "") { valores = cadenaCSV.Split(','); } else { valores = cadenaXLS.Split(','); } string[] ultimo = { null, null, null, null, null, null, null, null, null, null }; for (int i = 0; i < valores.Length; i++) { ultimo[i] = valores[i]; } string[] arreglo = { ultimo[0], ultimo[1], ultimo[2], ultimo[3], ultimo[4], ultimo[5], ultimo[6], ultimo[7], ultimo[8], ultimo[9] }; string cad = ""; for (int i = 0; i < (arreglo.Length); i++) { if (arreglo[i] == null) { cad = cad + "," + "null"; } else { cad = cad + "," + arreglo[i]; } } // int a=escribirNuevoXML(cad); CabecerasClass cabecera = new CabecerasClass { Arreglo = arreglo }; return(View(cabecera)); }
public IActionResult Index(IFormCollection formCollection) { //arreglo donde se guarda la seleccion del form string[] datos = new string[10]; try { datos[0] = formCollection["Id"]; datos[1] = formCollection["Name"]; datos[2] = formCollection["LastName"]; datos[3] = formCollection["Country"]; datos[4] = formCollection["Phone"]; datos[5] = formCollection["Addres"]; datos[6] = formCollection["Email"]; datos[7] = formCollection["Date"]; datos[8] = formCollection["Dni"]; datos[9] = formCollection["PostalCode"]; } catch (NullReferenceException e) { } CabecerasClass selected = new CabecerasClass { Arreglo = datos }; // Metodo para enviar string iría aca //string cad = ""; //for (int i = 0; i < (datos.Length); i++) //{ // cad = cad + "," + datos[i]; //} string cad = datos[0]; for (int i = 1; i < (datos.Length); i++) { if (datos[i] == null) { cad = cad + "," + "null"; } else { cad = cad + "," + datos[i]; } } int a = escribirNuevoXML(cad); // escribirXML(cad); return(Result(selected)); }
public IActionResult Result(CabecerasClass selected) { Console.WriteLine("------------.......................-"); return(View("Result")); }