Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Response<Unit> UpdateIntegrationSettings(UpdateIntegrationSettingsCommand command) { //_integrationSettingsCommandHandler.Update(command); using var scope = _dbScopeContext.CreateWriteDbScope(); using var transaction = scope.BeginTransaction(); var entity = scope .Query<ExternalIntegrationSettings>() .Include(it => it.Categories) .Include(it => it.OrganizationUnits) .FirstOrDefault(it => it.Id == command.EntityId); var model = ExternalIntegrationSettingsUpdateModel.Create(entity); command.UpdateModel(model); DeleteCategories(scope, entity.Categories, model.CategoryIdsToDelete); AddCategories(entity.Id, entity.Categories, model.CategoryIdsToAdd); DeleteOrganizationUnits(scope, entity.OrganizationUnits, model.OrganizationUnitIdsToDelete); AddOrganizationUnits(entity.Id, entity.OrganizationUnits, model.OrganizationUnitIdsToAdd); transaction.Success(); return Response.Success(); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement