Beispiel #1
0
        public bool UpdateEmployee(int employeeId, beEmployee employeeEntity)
        {
            var success = false;

            if (employeeEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var employee = _unitOfWork.EmployeeRepository.GetById(employeeId);
                    if (employee != null)
                    {
                        employee.FirstName  = employeeEntity.FirstName;
                        employee.MiddleName = employeeEntity.MiddleName;
                        employee.LastName   = employeeEntity.LastName;
                        employee.Email      = employeeEntity.Email;
                        employee.Mobile     = employeeEntity.Mobile;

                        _unitOfWork.EmployeeRepository.Update(employee);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
Beispiel #2
0
 public Guid CreateEmployee(beEmployee employeeEntity)
 {
     using (var scope = new TransactionScope())
     {
         var Employee = new Employee
         {
             FirstName  = employeeEntity.FirstName,
             MiddleName = employeeEntity.MiddleName,
             LastName   = employeeEntity.LastName,
             Email      = employeeEntity.Email,
             Mobile     = employeeEntity.Mobile
         };
         _unitOfWork.EmployeeRepository.Insert(Employee);
         _unitOfWork.Save();
         scope.Complete();
         return(Employee.Id);
     }
 }