public void Update(Guid employeeId, DtoEmployee newDtoEmployee)
        {
            var employeer = EmployeesRepository.First(e => e.Id == employeeId);

            employeer.FirstName  = newDtoEmployee.FirstName;
            employeer.MiddleName = newDtoEmployee.MiddleName;
            employeer.LastName   = newDtoEmployee.LastName;
            employeer.Email      = newDtoEmployee.Email;
            if (newDtoEmployee.PassHash != null)
            {
                employeer.PassHash = newDtoEmployee.PassHash;
            }
            employeer.Role    = newDtoEmployee.Role;
            employeer.Blocked = newDtoEmployee.Blocked;

            if (newDtoEmployee.DepartmentDirector != null)
            {
                employeer.DepartmentDirectorId = newDtoEmployee.DepartmentDirector.Id;
            }

            if (newDtoEmployee.Director != null)
            {
                employeer.DirectorId = newDtoEmployee.Director.Id;
            }

            _repositoryManager.SaveChanges();
        }
 public bool Verify(string email, string passHash, out DtoEmployee outEmployee)
 {
     if (EmployeesRepository.Any(e => e.Email == email))
     {
         var employee = Mapper.Map <DtoEmployee>(EmployeesRepository.First(e => e.Email == email));
         if (employee.PassHash == passHash)
         {
             outEmployee = employee;
             return(true);
         }
     }
     outEmployee = null;
     return(false);
 }
 public void Create(DtoEmployee dtoEmployee)
 {
     EmployeesRepository.Add(Mapper.Map <DbEmployee>(dtoEmployee));
     _repositoryManager.SaveChanges();
 }