コード例 #1
0
        // POST /api/employees/
        // body: JSON
        public IHttpActionResult Post([FromBody] dynamic data)
        {
            int venueId = (int)data.Venue.Id.Value;

            BookiAPI.DataAccessLayer.Models.Employee employee = new DataAccessLayer.Models.Employee
            {
                Name       = data.Employee.Name.Value,
                Phone      = data.Employee.Phone.Value,
                Email      = data.Employee.Email.Value.ToLower(),
                Password   = data.Employee.Password.Value,
                EmployeeNo = (int)data.Employee.EmployeeNo.Value,
                Title      = data.Employee.Title.Value,
                Salt       = data.Employee.Salt.Value
            };

            int employeeId = _employeeRepository.Add(employee);

            if (employeeId > 0)
            {
                if (_venueEmployeesController.Post(venueId, employeeId))
                {
                    return(Ok("Employee was created"));
                }
            }
            return(BadRequest("Something went wrong .."));
        }
コード例 #2
0
        public DataAccessLayer.Models.HumanResourcesInfo GetPersonInfo(int id)
        {
            DataAccessLayer.Models.Employee           employee   = DAL.GetEmployee(id);
            DataAccessLayer.Models.HumanResourcesInfo personInfo = LoadEmployee(employee);

            return(personInfo);
        }
コード例 #3
0
        DataAccessLayer.Models.HumanResourcesInfo LoadEmployee(DataAccessLayer.Models.Employee employee)
        {
            int id = employee.BusinessEntityID;

            DataAccessLayer.Models.EmployeeDepartmentHistory employeeDepartmentHistory = DAL.GetEmployeeDepartmentHistory(id);
            DataAccessLayer.Models.Department         department         = DAL.GetDepartment(employeeDepartmentHistory.DepartmentID);
            DataAccessLayer.Models.EmployeePayHistory employeePayHistory = DAL.GetEmployeePayHistory(id);
            DataAccessLayer.Models.JobCandidate       jobCandidate       = DAL.GetJobCandidate(id);
            DataAccessLayer.Models.HumanResourcesInfo humanResourcesInfo = new DataAccessLayer.Models.HumanResourcesInfo(department, employee, employeeDepartmentHistory, employeePayHistory, jobCandidate);
            return(humanResourcesInfo);
        }