public async Task <IActionResult> Update(int id, DepartmentDtos data)
        {
            var editData = await _repo.FindByIdAsync(id);

            if (editData == null)
            {
                return(NotFound());
            }

            editData.Name = data.Name;

            var updated = await _repo.Update(editData);

            return(StatusCode(204));
        }
        public async Task <IActionResult> Post(DepartmentDtos data)
        {
            if (await _repo.DataExists(data.Name))
            {
                return(BadRequest("Departamento já existe!"));
            }

            var dataToCreate = new Department
            {
                Name = data.Name
            };

            var created = await _repo.Save(dataToCreate);

            return(StatusCode(201, created));
        }