public AddressUser Create(CreateAddressUserCommand command) { var address = new AddressUser(command.Cep, command.Logradouro, command.Bairro, command.Localidade, command.Uf, command.Ibge, command.Gia, command.Number, command.Reference, command.IdUser); address.Create(); _repository.Create(address); if (Commit()) { return(address); } return(null); }
public Task <HttpResponseMessage> Post([FromBody] dynamic body) { var command = new CreateAddressUserCommand( 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, idUser: (int)body.idUser ); var address = _service.Create(command); return(CreateResponse(HttpStatusCode.OK, address)); }