public void Update(UpdateSectorCompanyCommand command) { if (!this.UpdateSectorCompanyScopeIsValid(command)) { return; } this.Sector = command.Sector; }
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)); }
public SectorCompany Update(UpdateSectorCompanyCommand command) { var sector = _repository.GetById(command.IdSectorCompany); sector.Update(command); _repository.Update(sector); if (Commit()) { return(sector); } return(null); }
public static bool UpdateSectorCompanyScopeIsValid(this SectorCompany sector, UpdateSectorCompanyCommand command) { return(AssertionConcern.IsSatisfiedBy ( AssertionConcern.AssertNotEmpty(command.Sector, "O setor é obrigatório") )); }