Exemplo n.º 1
0
        public void Handle(LocationCreatedEvent message)
        {
            // Create a new LocationDTO object from the LocationCreatedEvent
            LocationRM location = mapper.Map <LocationRM>(message);

            locationRepo.Save(location);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public void Save(LocationRM location)
 {
     Save(location.LocationID, location);
     MergeIntoAllCollection(location);
 }