public ActionResult AddNew() { CreateEmployeeViewModel employeeListViewModel = new CreateEmployeeViewModel(); //employeeListViewModel.footerViewModel = new FooterViewModel(); //employeeListViewModel.footerViewModel.CompanyName = "StepByStepSchools";//Can be set to dynamic value //employeeListViewModel.footerViewModel.Year = DateTime.Now.Year.ToString(); //employeeListViewModel.UserName = "******"; //New Line return View("CreateEmployee-Copy", employeeListViewModel); // return View("CreateEmployee"); }
public ActionResult SaveEmployee(Employee e, string BtnSubmit) { CreateEmployeeViewModel employeeListViewModel = new CreateEmployeeViewModel(); //employeeListViewModel.UserName = "******"; //employeeListViewModel.footerViewModel = new FooterViewModel(); //employeeListViewModel.footerViewModel.CompanyName = "tombola";//Can be set to dynamic value //employeeListViewModel.footerViewModel.Year = DateTime.Now.Year.ToString(); if (!ModelState.IsValid) { employeeListViewModel.firstName = e.firstName; employeeListViewModel.lastName = e.lastName; employeeListViewModel.salary = e.salary.ToString(); return View("CreateEmployee-Copy", employeeListViewModel); // Day 4 Change - Passing e here // return View("CreateEmployee-Copy", e); } EmployeeBusinessLayer empBal = new EmployeeBusinessLayer(); empBal.SaveEmployee(e); return RedirectToAction("gridView"); }