Exemple #1
0
        private void MergeIntoAllCollection(AgentRM agent)
        {
            List <AgentRM> allAgents = new List <AgentRM>();

            if (Exists("all"))
            {
                allAgents = Get <List <AgentRM> >("all");
            }

            //If the district already exists in the ALL collection, remove that entry
            if (allAgents.Any(x => x.AgentID == agent.AgentID))
            {
                allAgents.Remove(allAgents.First(x => x.AgentID == agent.AgentID));
            }

            //Add the modified district to the ALL collection
            allAgents.Add(agent);

            Save("all", allAgents);
        }
        public async Task Handle(AgentCreatedEvent message)
        {
            AgentRM agent = _mapper.Map <AgentRM>(message);

            _agentRepo.Save(agent);
        }
Exemple #3
0
 public void Save(AgentRM agent)
 {
     Save(agent.AgentID, agent);
     MergeIntoAllCollection(agent);
 }