public string BatchAddCustomer(BatchSubmitCustomer input) { List<Customer> list = new List<Customer>(); for( int i = 0; i < input.Name.Length; i++ ) { if( input.Name[i].Length > 0 && TryToInt(input.Age[i]) > 0 && input.Tel[i].Length > 0 ) { Customer c = new Customer { Name = input.Name[i], Age = TryToInt(input.Age[i]), Address = input.Address[i], Tel = input.Tel[i], Email = input.Email[i] }; list.Add(c); } } return XmlHelper.XmlSerialize(list, Encoding.UTF8); }
public string BatchAddCustomer(BatchSubmitCustomer input) { List <Customer> list = new List <Customer>(); for (int i = 0; i < input.Name.Length; i++) { if (input.Name[i].Length > 0 && TryToInt(input.Age[i]) > 0 && input.Tel[i].Length > 0) { Customer c = new Customer { Name = input.Name[i], Age = TryToInt(input.Age[i]), Address = input.Address[i], Tel = input.Tel[i], Email = input.Email[i] }; list.Add(c); } } return(XmlHelper.XmlSerialize(list, Encoding.UTF8)); }