public Task IndexShow(ShowDocument ShowDocument) { shows.RemoveAll(s => s.ActGuid == ShowDocument.ActGuid && s.VenueGuid == ShowDocument.VenueGuid && s.StartTime == ShowDocument.StartTime); shows.Add(DeepCopy(ShowDocument)); return(Task.CompletedTask); }
public async Task IndexShow(ShowDocument show) { show.Id = HashOfKey(new { ActGuid = show.ActGuid, StartTime = show.StartTime, VenueGuid = show.VenueGuid }); var response = await elasticClient.IndexDocumentAsync(show); if (!response.IsValid) { throw new InvalidOperationException($"Error indexing show: {response.DebugInformation}"); } }
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; } }