public void Update(UpdateSectorCompanyCommand command)
        {
            if (!this.UpdateSectorCompanyScopeIsValid(command))
            {
                return;
            }

            this.Sector = command.Sector;
        }
Ejemplo n.º 2
0
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateSectorCompanyCommand(
                idSectorCompany: id,
                sector: (string)body.sector
                );

            var sector = _service.Update(command);

            return(CreateResponse(HttpStatusCode.OK, sector));
        }
Ejemplo n.º 3
0
        public SectorCompany Update(UpdateSectorCompanyCommand command)
        {
            var sector = _repository.GetById(command.IdSectorCompany);

            sector.Update(command);
            _repository.Update(sector);

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

            return(null);
        }
Ejemplo n.º 4
0
 public static bool UpdateSectorCompanyScopeIsValid(this SectorCompany sector, UpdateSectorCompanyCommand command)
 {
     return(AssertionConcern.IsSatisfiedBy
            (
                AssertionConcern.AssertNotEmpty(command.Sector, "O setor é obrigatório")
            ));
 }