public bool CreateEmployee(Employee employee)
        {
            if (employee == null)
            {
                return(false);
            }

            return(_employeeBusinessService.CreateEmployee(employee));
        }
Exemplo n.º 2
0
        public IActionResult Post([FromBody, Required] Employee employee)
        {
            if (employee == null)
            {
                return(StatusCode(400, "Dados não encontrados"));
            }

            ModelState.Clear();

            TryValidateModel(employee);

            if (ModelState.IsValid)
            {
                var result = _employeeBusinessService.CreateEmployee(employee);

                return(Ok(result));
            }
            else
            {
                return(StatusCode(400, ModelState));
            }
        }