title: How to use Tempdata to display the list
body: <p>I have did the excel upload in  dotnet core .I had to use tempdata to retrieve the details of the excel in list.Instead in my below code i had used Static object to retrieve the list.My code works as like this ,when i click on upload button it will display the details in the excel sheet.and when click on save it will save it to database and i need to edit in grid view using ajax call also .Help me out</p>
  
  <p>My Action in controller is </p>
  
  <pre><code>public async Task&lt;IActionResult&gt; ImportEmployeeDetails(IFormFile excelfile)
  {
          try
          {
              EmployeesViewModelList employeesListObject = new EmployeesViewModelList();
              List&lt;EmployeeModel&gt; employeesViewModelList = new List&lt;EmployeeModel&gt;();
              if (excelfile == null || excelfile.Length == 0)
              {
                  return View(employeesListObject);
              }
              var supportedTypes = new[] { ".xls", ".xlsx" };
              var ext = Path.GetExtension(excelfile.FileName);
              if (!supportedTypes.Contains(ext))
              {
                  return View(employeesListObject);
              }
              var path = Path.Combine(
                         Directory.GetCurrentDirectory(), "wwwroot",
                         "EmployeeDetails.xlsx");
  
              if (System.IO.File.Exists(path))
              {
                  System.IO.File.Delete(path);
              }
  
              using (var stream = new FileStream(path, FileMode.Create))
              {
                  await excelfile.CopyToAsync(stream);
              }
              FileInfo file = new FileInfo(path);
              using (ExcelPackage package = new ExcelPackage(file))
              {
                  ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
                  int rowCount = worksheet.Dimension.Rows;
                  int ColCount = worksheet.Dimension.Columns;
  
                  for (int i = 2; i &lt;= rowCount; i++)
                  {
                      EmployeeModel emp = new EmployeeModel();
                      emp.EmployeeId = Convert.ToInt32(worksheet.Cells[i, 1].Value.ToString());
  
                      emp.EmpFirstName = worksheet.Cells[i, 2].Value.ToString();
                      employeesViewModelList.Add(emp);
  
                  }
  
                  employeesListObject.EmpModelList = employeesViewModelList;
                  return View(employeesListObject);
  
              }
          }
          catch(Exception ex)
          {
              TempData["Message"] = "Opps! Something Went wrong!";
              return RedirectToAction("ExcelPackage");
          }
  }
  </code></pre>