public async Task <IActionResult> Post([FromBody] CreateSecretaryDto secretary)
        {
            var listError = ValidPropertiesObject.ObjIsValid(secretary);

            if (listError.Count > 0)
            {
                return(await ResponseNullOrEmpty(listError));
            }

            var result = _service.Create(secretary);

            return(await Response(result, _service.Validate()));
        }
        public Secretary Create(CreateSecretaryDto secretary)
        {
            var user = _service.Create(new CreateUserDto(secretary.Email, secretary.Password, secretary.Nickname, (int)EPermission.Secretary, secretary.Enabled));

            if (user.Invalid)
            {
                AddNotifications(user.Notifications);
                return(null);
            }
            var secretaryTemp = new Secretary(0, secretary.Name, secretary.Document, secretary.Enabled, user);

            if (_repository.SecretaryExists(secretaryTemp))
            {
                AddNotification("Secretary", "O secretário/a já existe!");
            }
            if (secretaryTemp.Valid)
            {
                _repository.Save(secretaryTemp);
            }
            AddNotifications(user.Notifications);
            return(secretaryTemp);
        }