public Task UpdateShowsWithVenueDescription(string venueGuid, VenueDescription venueDescription) { foreach (var show in shows.Where(s => s.VenueGuid == venueGuid)) { show.VenueDescription = DeepCopy(venueDescription); } return(Task.CompletedTask); }
public async Task Handle(ShowAdded showAdded) { Console.WriteLine($"Indexing a show for {showAdded.act.description.title} at {showAdded.venue.description.name}."); try { string actGuid = showAdded.act.actGuid.ToString().ToLower(); string venueGuid = showAdded.venue.venueGuid.ToString().ToLower(); ActDescription actDescription = ActDescription.FromRepresentation(showAdded.act.description); VenueDescription venueDescription = VenueDescription.FromRepresentation(showAdded.venue.description); VenueLocation venueLocation = VenueLocation.FromRepresentation(showAdded.venue.location); ActDocument act = await actUpdater.UpdateAndGetLatestAct(new ActDocument { ActGuid = actGuid, Description = actDescription }); VenueDocument venue = await venueUpdater.UpdateAndGetLatestVenue(new VenueDocument { VenueGuid = venueGuid, Description = venueDescription, Location = venueLocation }); var show = new ShowDocument { ActGuid = actGuid, VenueGuid = venueGuid, StartTime = showAdded.show.startTime, ActDescription = act.Description, VenueDescription = venue.Description, VenueLocation = venue.Location }; await repository.IndexShow(show); Console.WriteLine("Succeeded"); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public async Task UpdateShowsWithVenueDescription(string venueGuid, VenueDescription venueDescription) { await elasticClient.UpdateByQueryAsync <ShowDocument>(ubq => ubq .Query(q => q .Match(m => m .Field(f => f.VenueGuid) .Query(venueGuid) ) ) .Script(s => s .Source("ctx._source.venueDescription = params.venueDescription") .Params(p => p .Add("venueDescription", venueDescription) ) ) .Conflicts(Conflicts.Proceed) .Refresh(true) ); }
public async Task Handle(VenueDescriptionChanged venueDescriptionChanged) { Console.WriteLine($"Updating index for venue {venueDescriptionChanged.description.name}."); try { string venueGuid = venueDescriptionChanged.venueGuid.ToString().ToLower(); VenueDescription venueDescription = VenueDescription.FromRepresentation(venueDescriptionChanged.description); VenueDocument updatedVenue = new VenueDocument { VenueGuid = venueGuid, Description = venueDescription }; VenueDocument venue = await venueUpdater.UpdateAndGetLatestVenue(updatedVenue); await repository.UpdateShowsWithVenueDescription(venueGuid, venue.Description); Console.WriteLine("Succeeded"); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }