public ObjectRequest EditeAddressCustomer(EditeAddressCommand cmd) { var address = _repAddress.GetEntity(cmd.AddressId); if (address == null) { return(new ObjectRequest().CreateObjectRequest("Endereco nao Registrado", false)); } address.Edit(cmd.Street, cmd.Number, cmd.Complement, cmd.District, cmd.City, cmd.State, cmd.CEP); if (Commit(address)) { return(new ObjectRequest().CreateObjectRequest("Endereco Atualizado com Sucesso", true)); } return(new ObjectRequest().CreateErrorNotification(address.ListErrors())); }
public async Task <IActionResult> EditAddressCustomer([FromBody] dynamic body) { try { var cmd = new EditeAddressCommand { CEP = (string)body.cep, City = (string)body.city, Complement = (string)body.complement, AddressId = (Guid)body.addressId, District = (string)body.district, Number = (int)body.number, State = (string)body.state, Street = (string)body.street }; var result = _service.EditeAddressCustomer(cmd); return(await CreateResponse(result)); } catch (Exception ex) { return(await ServerErroApp(ex)); } }