public ActionResult Export() { MyExcel.DB_PATH = @"D:\output\My projects\ASP.NET\Management System v2\Movies App\Movies App\App_Data\movies_export.xlsx"; MyExcel.InitializeExcel(); var movies = Movie.getMovies().ToList(); foreach (var movie in movies) { MyExcel.WriteToExcel(movie); } MyExcel.CloseExcel(); return(View()); }
public ActionResult Import() { MyExcel.DB_PATH = @"D:\output\My projects\ASP.NET\Management System v2\Movies App\Movies App\App_Data\movies.xlsx"; MyExcel.InitializeExcel(); List <Movie> excelMovies = MyExcel.ReadMyExcel().ToList(); foreach (var movie in excelMovies) { Movie.addMovie(movie); } MyExcel.CloseExcel(); return(View(excelMovies)); }