Esempio n. 1
0
        public async Task <EmployeeApiModel> AddEmployeeAsync(EmployeeApiModel newEmployeeApiModel,
                                                              CancellationToken ct = default)
        {
            /*var employee = new Employee
             * {
             *  LastName = newEmployeeApiModel.LastName,
             *  FirstName = newEmployeeApiModel.FirstName,
             *  Title = newEmployeeApiModel.Title,
             *  ReportsTo = newEmployeeApiModel.ReportsTo,
             *  BirthDate = newEmployeeApiModel.BirthDate,
             *  HireDate = newEmployeeApiModel.HireDate,
             *  Address = newEmployeeApiModel.Address,
             *  City = newEmployeeApiModel.City,
             *  State = newEmployeeApiModel.State,
             *  Country = newEmployeeApiModel.Country,
             *  PostalCode = newEmployeeApiModel.PostalCode,
             *  Phone = newEmployeeApiModel.Phone,
             *  Fax = newEmployeeApiModel.Fax,
             *  Email = newEmployeeApiModel.Email
             * };*/

            var employee = newEmployeeApiModel.Convert();

            employee = await _employeeRepository.AddAsync(employee, ct);

            newEmployeeApiModel.EmployeeId = employee.EmployeeId;
            return(newEmployeeApiModel);
        }
        public EmployeeApiModel AddEmployee(EmployeeApiModel newEmployeeApiModel)
        {
            var employee = newEmployeeApiModel.Convert();

            employee = _employeeRepository.Add(employee);
            newEmployeeApiModel.EmployeeId = employee.EmployeeId;
            return(newEmployeeApiModel);
        }