コード例 #1
0
        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());
        }
コード例 #2
0
        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));
        }