public ActionResult Edit(int id = 0) { var employee = EmployeeHandler.GetEmployee(id); var employeeModel = EmployeeModelMapper.MapToEmployeeModel(employee); return(View(employeeModel)); }
public ViewResult Index(bool includeNonActive = false) { var model = new EmployeeIndexModel(); model.IncludeNonActive = includeNonActive; var empList = EmployeeHandler.GetAllEmployee(includeNonActive); foreach (var emp in empList) { var empModel = EmployeeModelMapper.MapToEmployeeModel(emp); model.EmployeeList.Add(empModel); } return(View(model)); }
public ActionResult Add(EmployeeModel model) { var employee = EmployeeModelMapper.MapToEmployee(model); try { employee.IsActive = true; EmployeeHandler.Add(employee); } catch (Exception ex) { model.Error = ex.Message; return(View("Add", model)); } var empModel = EmployeeModelMapper.MapToEmployeeModel(employee); return(View("Add", empModel)); }