public async Task <IActionResult> GetEmployee(string buscar)
        {
            int id = 0;
            IEnumerable <Employee> employees;
            List <EmployeeDTO>     employeesDTO = new List <EmployeeDTO>();

            Int32.TryParse(buscar, out id);
            if (id == 0)
            {
                employees = await _repository.List();
            }
            else
            {
                var t = await _repository.GetById(id);

                if (t != null)
                {
                    employees = new List <Employee> {
                        t
                    };
                }
                else
                {
                    employees = await _repository.List();
                }
            }

            foreach (var item in employees)
            {
                var emp = new EmployeeDTO();
                emp.FromEmployee(item);
                employeesDTO.Add(emp);
            }
            return(View("Index", employeesDTO));
        }
        public async Task <ActionResult <string> > GetByID(int id)
        {
            var result   = "Employee not found";
            var employee = await _repository.GetById(id);

            if (employee != null)
            {
                var emp = new EmployeeDTO();
                emp.FromEmployee(employee);

                result = JsonConvert.SerializeObject(emp);
            }
            return(result);
        }
        public async Task <ActionResult <string> > GetEmployees()
        {
            var result    = "Employee not found";
            var employees = await _repository.List();

            List <EmployeeDTO> employeesDTO = new List <EmployeeDTO>();

            foreach (var employee in employees)
            {
                var emp = new EmployeeDTO();
                emp.FromEmployee(employee);
                employeesDTO.Add(emp);
            }

            result = JsonConvert.SerializeObject(employeesDTO);

            return(result);
        }