Пример #1
0
        public async Task <AgentDeployEntity> Update(AgentDeploy agent)
        {
            var updater = Builders <AgentDeployEntity> .Update.Set(a => a.Abilities, agent.Abilities)
                          .Set(a => a.LastUpTime, agent.LastUpTime)
                          .Set(a => a.Availability, agent.Availability)
                          .Set(a => a.Folders, agent.Folders);

            var entity = await deployCollection.FindOneAndUpdateAsync(a => a.Url == agent.Url, updater);

            return(entity);
        }
Пример #2
0
        public async Task <AgentDeployEntity> Add(AgentDeploy agent)
        {
            var entity = new AgentDeployEntity
            {
                Availability = agent.Availability,
                Abilities    = agent.Abilities,
                Folders      = agent.Folders,
                LastUpTime   = agent.LastUpTime,
                Url          = agent.Url
            };

            await deployCollection.InsertOneAsync(entity);

            return(entity);
        }