public AddressCompany Update(UpdateAddressCompanyCommand command) { var address = _repository.GetById(command.IdAddressCompany); address.Update(command); _repository.Update(address); if (Commit()) { return(address); } return(null); }
public void Update(UpdateAddressCompanyCommand command) { if (!this.UpdatePhoneCompanyScopeIsValid(command)) { return; } this.Cep = command.Cep; this.Logradouro = command.Logradouro; this.Complemento = command.Complemento; this.Bairro = command.Bairro; this.Localidade = command.Localidade; this.Uf = command.Uf; this.Ibge = command.Ibge; this.Gia = command.Gia; this.Number = command.Number; this.Reference = command.Reference; }
public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body) { var command = new UpdateAddressCompanyCommand( idAddressCompany: id, cep: (string)body.cep, logradouro: (string)body.logradouro, complemento: (string)body.complemento, bairro: (string)body.bairro, localidade: (string)body.localidade, uf: (string)body.uf, ibge: (string)body.ibge, gia: (string)body.gia, number: (string)body.number, reference: (string)body.reference ); var address = _service.Update(command); return(CreateResponse(HttpStatusCode.OK, address)); }
public static bool UpdatePhoneCompanyScopeIsValid(this AddressCompany category, UpdateAddressCompanyCommand command) { return(AssertionConcern.IsSatisfiedBy ( AssertionConcern.AssertNotEmpty(command.Cep, "A Cep é obrigatória"), AssertionConcern.AssertNotEmpty(command.Number, "O Número é obrigatório") )); }