コード例 #1
0
        public Project Insert(Project project)
        {
            project.ProjectNo = counterRepo.GetNextCounter("project").CounterValue;
            project.CreatedOn = DateTime.Now;
            Collection.InsertOne(project);

            return(project);
        }
コード例 #2
0
        public Step InsertStep(Step step)
        {
            step.StepNo    = counterRepo.GetNextCounter("step").CounterValue;
            step.CreatedOn = DateTime.Now;

            if (step.Invocations == null)
            {
                step.Invocations = new List <Invocation>();
            }

            var scenarioFilter = Builders <Scenario> .Filter.Eq(sc => sc.ScenarioNo, step.ScenarioNo);

            var addStep = Builders <Scenario> .Update.Push("Steps", step);

            Collection.FindOneAndUpdate(scenarioFilter, addStep);

            return(step);
        }