Beispiel #1
0
        public void Update(UpdateEmployeeCompanyCommand command)
        {
            if (!this.UpdateEmployeeCompanyScopeIsValid(command))
            {
                return;
            }

            this.Cpf             = command.Cpf;
            this.IdSectorCompany = command.IdSectorCompany;
        }
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateEmployeeCompanyCommand(
                idEmployeeCompany: id,
                cpf: (string)body.cpf,
                idSectorCompany: (int)body.idSectorCompany
                );

            var employee = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, employee));
        }
        public EmployeeCompany Update(UpdateEmployeeCompanyCommand command)
        {
            var employee = _repository.GetById(command.IdEmployeeCompany);

            employee.Update(command);
            _repository.Update(employee);

            if (Commit())
            {
                return(employee);
            }

            return(null);
        }
Beispiel #4
0
 public static bool UpdateEmployeeCompanyScopeIsValid(this EmployeeCompany employee, UpdateEmployeeCompanyCommand employeeCompany)
 {
     return(AssertionConcern.IsSatisfiedBy
            (
                AssertionConcern.AssertNotEmpty(employeeCompany.Cpf, "O CPF é obrigatório")
            ));
 }