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 Notify(Show show) { var act = await actQueries.GetAct(show.Act.ActGuid); var venue = await venueQueries.GetVenue(show.Venue.VenueGuid); var showAdded = new ShowAdded { act = new ActRepresentation { actGuid = act.ActGuid, description = new ActDescriptionRepresentation { title = act.Title, imageHash = act.ImageHash, modifiedDate = new DateTime(act.LastModifiedTicks) } }, venue = new VenueRepresentation { venueGuid = venue.VenueGuid, description = new VenueDescriptionRepresentation { name = venue.Name, city = venue.City, modifiedDate = new DateTime(venue.LastModifiedTicks) }, location = venue.ToVenueLocationRepresentation(), timeZone = new VenueTimeZoneRepresentation { timeZone = venue.TimeZone, modifiedDate = new DateTime(venue.TimeZoneLastModifiedTicks) } }, show = new ShowRepresentation { startTime = show.StartTime } }; await publishEndpoint.Publish(showAdded); }
public Task Handle(ShowAdded message) { Console.WriteLine($"Emailing about a show for {message.act.description.title} at {message.venue.description.name}."); return(Task.CompletedTask); }