public ActionResult UpdateEmployee(int id) { ManiEmployeesViewModel model = new ManiEmployeesViewModel() { Employee = _employeeManager.GetEmployee(id), Titles = _titleManager.GetTitles(), ButtonName = "Update Employee", }; return(View(model)); }
public ActionResult AddNewEmployee() { ManiEmployeesViewModel model = new ManiEmployeesViewModel() { Employee = new Employee(), Titles = _titleManager.GetTitles(), ButtonName = "Add Employee", }; return(View(model)); }
public ActionResult UpdateEmployee(Employee employee) { if (!ModelState.IsValid) { ManiEmployeesViewModel model = new ManiEmployeesViewModel() { Employee = _employeeManager.GetEmployee(employee.EmployeeID), Titles = _titleManager.GetTitles(), ButtonName = "Update Employee", }; return(View(model)); } _employeeManager.UpdateEmployee(employee); TempData["message"] = "Çalışan Güncellendi"; return(RedirectToAction("EmployeeManiPage")); }
public ActionResult AddNewEmployee(Employee employee) { if (!ModelState.IsValid) { ManiEmployeesViewModel model = new ManiEmployeesViewModel() { Employee = new Employee(), Titles = _titleManager.GetTitles(), ButtonName = "Add Employee", }; return(View(model)); } _employeeManager.AddEmployee(employee); TempData["message"] = "Yeni çalışan eklendi"; return(RedirectToAction("EmployeeManiPage")); }