public ResponseMessageData <bool> RemoveRelPhoneAddress(AddressPhoneModel model) { try { return(AppInit.Container.Resolve <IOrderService>().RemoveRelPhoneAddress(model)); } catch (Exception ex) { SharedLogger.LogError(ex); return(ResponseMessageData <bool> .CreateCriticalMessage("No fue posible eliminar la relación teléfono-dirección")); } }
public void RemoveRelPhoneAddress(AddressPhoneModel model) { var address = new Entities.Address { AddressId = model.AddressId }; var phone = new ClientPhone { ClientPhoneId = model.AddressPhoneId }; address.ClientPhone.Add(phone); DbEntities.Address.Attach(address); address.ClientPhone.Remove(phone); DbEntities.SaveChanges(); }
public ResponseMessageData <bool> RemoveRelPhoneAddress(AddressPhoneModel model) { using (_repository) { if (_repository.RelPhoneAddressExists(model)) { _repository.RemoveRelPhoneAddress(model); } return(new ResponseMessageData <bool> { Data = true, IsSuccess = true }); } }
private void DoRemoveAddress(MessageDialogResult result, AddressInfoGrid clInfo) { if (result != MessageDialogResult.Affirmative) { return; } var relClientPhone = new AddressPhoneModel { AddressId = clInfo.AddressInfo.AddressId ?? SharedConstants.NULL_ID_VALUE, AddressPhoneId = clInfo.AddressInfo.PrimaryPhone.PhoneId }; _client.ExecutionProxy .ExecuteRequest <AddressPhoneModel, AddressPhoneModel, ResponseMessageData <bool>, ResponseMessageData <bool> > (relClientPhone, TransferDto.SameType, SharedConstants.Server.ADDRESS_HUB, SharedConstants.Server.REMOVE_REL_PHONECLIENT_ADDRESS_HUB_METHOD, TransferDto.SameType) .Subscribe(x => OnRemoveDone(x, clInfo), OnRemoveError); }
public bool RelPhoneAddressExists(AddressPhoneModel model) { return (DbEntities.Address.Any( e => e.AddressId == model.AddressId && e.ClientPhone.Any(i => i.ClientPhoneId == model.AddressPhoneId))); }