Пример #1
0
        public ActionResult AddEmployee([DataSourceRequest] DataSourceRequest request, EmployeeModel employeeModel)
        {
            try
            {
                if (employeeModel != null)
                {
                    this.systemEmployeeService = new SystemEmployeeService();

                    var backstageEmployee = DataTransfer.Transfer<System_Employee>(
                        employeeModel,
                        typeof(EmployeeModel));

                    employeeModel.ID = this.systemEmployeeService.AddEmployee(backstageEmployee);

                    if (employeeModel.ID > 0)
                    {
                        return this.Json(new[] { employeeModel }.ToDataSourceResult(request, this.ModelState));
                    }
                }
            }
            catch (Exception exception)
            {
                throw new Exception("添加员工时发生错误", exception);
            }

            return this.View();
        }
Пример #2
0
        public ActionResult ModifyEmployee([DataSourceRequest] DataSourceRequest request, EmployeeModel employeeModel)
        {
            if (employeeModel != null && this.ModelState.IsValid)
            {
                this.systemEmployeeService = new SystemEmployeeService();

                var backstageEmployee = DataTransfer.Transfer<System_Employee>(
                    employeeModel,
                    typeof(EmployeeModel));

                this.systemEmployeeService.ModifyEmployee(backstageEmployee);
            }

            return this.Json(new[] { employeeModel }.ToDataSourceResult(request, this.ModelState));
        }