public IActionResult Index() { var context = new EmployeeContext(); var employees = context.Employees.ToList(); return View(new IndexViewModel { Employees = employees }); }
public IActionResult Index(IndexViewModel viewModel) { var context = new EmployeeContext(); context.Employees.Add(viewModel.NewEmployee); context.SaveChanges(); var employees = context.Employees.ToList(); return View(new IndexViewModel { Employees = employees }); }