private bool CreateAgent(AgentState init, bool replaceExisiting) { bool created = false; ReadModifyWriteState(state => { init.Created = DateTimeOffset.UtcNow; init.LastModified = init.Created; if (!state.Agents.ContainsKey(init.Id)) { state.Agents.Add(init.Id, init); created = true; } else if (replaceExisiting) { state.Agents[init.Id] = init; created = true; } }); return(created); }
private bool CreateAgent(AgentState init, bool replaceExisiting) { bool created = false; ReadModifyWriteState(state => { init.Created = DateTimeOffset.UtcNow; init.LastModified = init.Created; if (!state.Agents.ContainsKey(init.Id)) { state.Agents.Add(init.Id, init); created = true; } else if(replaceExisiting) { state.Agents[init.Id] = init; created = true; } }); return created ; }