public void Handle(LocationCreatedEvent message) { // Create a new LocationDTO object from the LocationCreatedEvent LocationRM location = mapper.Map <LocationRM>(message); locationRepo.Save(location); }
private void MergeIntoAllCollection(LocationRM location) { List <LocationRM> allLocations = new List <LocationRM>(); if (Exists("all")) { allLocations = Get <List <LocationRM> >("all"); } // If the ?district already exists in the "all" collection, remove that entry if (allLocations.Any(l => l.LocationID == location.LocationID)) { allLocations.Remove(allLocations.First(l => l.LocationID == location.LocationID)); } // Add the modified ?district to the "all" collection allLocations.Add(location); Save("all", allLocations); }
public void Save(LocationRM location) { Save(location.LocationID, location); MergeIntoAllCollection(location); }