public IEnumerable <EmployeeDto> GetEmployeesByName(string name)
        {
            List <Employee> list;

            name = name.ToLower().TrimStart();
            String[] fullName = null;
            fullName = name.Split(' ');
            if (fullName.Length >= 2)
            {
                list = _repository.Employees
                       .Where(x => (x.Surname.ToLower().Contains(fullName[0]) && x.FirstName.ToLower().Contains(fullName[1]) || x.Surname.ToLower().Contains(fullName[1]) && x.FirstName.ToLower().Contains(fullName[0])))
                       .ToList();
            }
            else
            {
                list = _repository.Employees
                       .Where(x => (x.Surname.ToLower().Contains(fullName[0]) || x.FirstName.ToLower().Contains(fullName[0])))
                       .ToList();
            }
            //var list = _repository.Emloyees.Where(x => (x.Surname.ToLower().Contains(name) || x.FirstName.ToLower().Contains(name)).ToList();

            if (list.Count() > 0)
            {
                var dtoS = list.Select(dev => DTOMapper.GetEmployeeDto(dev)).ToList();
                return(dtoS);
            }
            else
            {
                return(null);
            }
        }
        public IEnumerable <EmployeeDto> GetEmployeesByQuery(string query)
        {
            //Query by id
            List <Employee> result;
            int             n;

            if (int.TryParse(query, out n))
            {
                result = _repository.Employees.Where(e => e.EmployeeId.ToString().StartsWith(query)).ToList();
            }
            else
            {
                result = _repository.Employees.Where(e => e.FirstName.StartsWith(query) || e.Surname.StartsWith(query))
                         .ToList();
            }

            var dtos = new List <EmployeeDto>();

            foreach (var entity in result)
            {
                dtos.Add(DTOMapper.GetEmployeeDto(entity));
            }

            return(dtos);
        }
        public EmployeeDto GetEmployee(int id)
        {
            var developer = _repository.Get(id);

            if (developer == null)
            {
                return(null);
            }

            return(DTOMapper.GetEmployeeDto(developer));
        }
        public IEnumerable <EmployeeDto> GetAllEmployees()
        {
            var list = new List <EmployeeDto>();

            foreach (var dev in _repository.Employees)
            {
                list.Add(DTOMapper.GetEmployeeDto(dev));
            }

            return(list);
        }
        public IEnumerable <EmployeeDto> GetDevelopersByTechnology(string technology)
        {
            technology = technology.ToLower();
            var list = _repository.Employees.Where(x => x.Technologies.Select(t => t.Name.ToLower()).ToList().Any(s => s.Contains(technology))).ToList();

            if (list.Count() > 0)
            {
                var dtoS = list.Select(dev => DTOMapper.GetEmployeeDto(dev)).ToList();
                return(dtoS);
            }
            else
            {
                return(null);
            }
        }