public void then_it_updates_multiple_entities() { UpdateCommand <SampleEntity> updateOp = SUT.UpdateMany <SampleEntity>( x => x.GuidProperty == _commonGuidValue); updateOp.Assign(x => x.DateProperty, x => DateTime.Now); int changes = updateOp.Execute(); changes.ShouldEqual(_entitiesCount); }
public virtual async Task DisableAllDeliveryTypes(long subscriberId) { using (Repository repository = new Repository(_dbContextFactory.GetDbContext())) { UpdateCommand <SubscriberDeliveryTypeSettingsLong> updateCommand = repository.UpdateMany <SubscriberDeliveryTypeSettingsLong>( x => x.SubscriberId == subscriberId); updateCommand.Assign(x => x.IsEnabled, x => false); int changes = await updateCommand.ExecuteAsync().ConfigureAwait(false); } }
public virtual async Task UpdateTimeZone(long subscriberId, TimeZoneInfo timeZone) { using (Repository repository = new Repository(_dbContextFactory.GetDbContext())) { UpdateCommand <SubscriberDeliveryTypeSettingsLong> updateCommand = repository.UpdateMany <SubscriberDeliveryTypeSettingsLong>( x => x.SubscriberId == subscriberId); updateCommand.Assign(x => x.TimeZoneId, x => timeZone.Id); int changes = await updateCommand.ExecuteAsync().ConfigureAwait(false); } }
public virtual async Task UpdateAddress(long subscriberId, int deliveryType, string address) { using (Repository repository = new Repository(_dbContextFactory.GetDbContext())) { UpdateCommand <SubscriberDeliveryTypeSettingsLong> command = repository.UpdateMany <SubscriberDeliveryTypeSettingsLong>( x => x.SubscriberId == subscriberId && x.DeliveryType == deliveryType); command.Assign(x => x.Address, x => address); int changes = await command.ExecuteAsync().ConfigureAwait(false); } }
public virtual async Task UpdateNDRResetCode(long subscriberId, int deliveryType, string resetCode) { using (Repository repository = new Repository(_dbContextFactory.GetDbContext())) { UpdateCommand <SubscriberDeliveryTypeSettingsLong> updateCommand = repository.UpdateMany <SubscriberDeliveryTypeSettingsLong>( x => x.SubscriberId == subscriberId && x.DeliveryType == deliveryType); updateCommand.Assign(x => x.NDRBlockResetCode, x => resetCode) .Assign(x => x.NDRBlockResetCodeSendDateUtc, x => DateTime.UtcNow); int changes = await updateCommand.ExecuteAsync().ConfigureAwait(false); } }