public void Apply(Import i) { i.Type = Type; i.Notify = Notify; for (var j=0; j<i.Columns.Length; j++) { i.Columns[j].Target = Columns[j].Target; i.Columns[j].CustomTarget = Columns[j].CustomTarget; } }
public static ImportEditModel FromDomain(Import i) { return new ImportEditModel { Type = i.Type, Location = i.Location, Notify = i.Notify, Columns = i.Columns ?? new ImportColumn[0], Attempts = i.Attempts ?? new List<ImportAttempt>(), }; }
protected IImportSource GetSourceForImport(Import i) { if (i.Location.EndsWith(".csv")) { return new CsvImportSource(i.Location.ToAbsoluteUrl().ToString()); } if (i.Location.EndsWith(".xls") || i.Location.EndsWith((".xlsx"))) { return new ExcelImportSource(i.Location.ToAbsoluteUrl().ToString()); } throw new NotSupportedException(); }