Exemplo n.º 1
0
        public Guid?PruebaInsertAndUpdate()
        {
            ProcessHistory updated = null;

            using (var scope = new TransactionScope())
            {
                logger.LogInformation("PruebaInsertAndUpdate");
                items.Add(a => false, "Pepe");
                var r = items.GetAll();

                var product1       = new ProductSpecification("Codigo 1");
                var processHistory = new ProcessHistory(Guid.NewGuid(), DateTime.Now.AddMinutes(-20), product1);

                var inserted = repository.InsertAsync(processHistory).Result;

                var product2 = new ProductSpecification("Codigo 2");
                inserted.SetProductSpecification(product2);
                inserted.FinishProcess(DateTime.Now);

                updated = repository.UpdateAsync(inserted).Result;

                scope.Complete();
            }

            var r2 = items.GetAll();

            return(updated?.Id);
        }
Exemplo n.º 2
0
        private Guid PruebaInsertAndUpdate()
        {
            var product1       = new ProductSpecification("Codigo 1");
            var processHistory = new ProcessHistory(Guid.NewGuid(), DateTime.Now.AddMinutes(-20), product1);

            var inserted = repository.InsertAsync(processHistory).Result;

            var product2 = new ProductSpecification("Codigo 2");

            inserted.SetProductSpecification(product2);
            inserted.FinishProcess(DateTime.Now);

            var interruptionDisabled = inserted.Copy();

            var updated = repository.UpdateAsync(inserted).Result;

            return(updated.Id);
        }