Ejemplo n.º 1
0
        public void AddOrderLine()
        {
            var order = new Order
            {
                Id = Guid.NewGuid(),
                OrderNo = "PO_0005"
            };

            order.OrderLines = new List<OrderLine> {
                new OrderLine {
                    Id = Guid.NewGuid(),
                    OrderId = order.Id,
                    ProductId = new Guid("85C2B3A5-117B-8BD2-AA78-39D8D7E7B218")
                }
            };

            var uowManager = IocManager.Instance.Resolve<IUnitOfWorkManager>();

            using (var uow = uowManager.Begin())
            {
                var repository = new OrderRepository();

                repository.Add(order);
                //repository.Context.SaveChanges();

                uow.Complete();
            }
        }
Ejemplo n.º 2
0
        public void AddOrder()
        {
            var order = new Order
            {
                 OrderNo = "PO_0004"
            };

            var uowManager = IocManager.Instance.Resolve<IUnitOfWorkManager>();

            using (var uow = uowManager.Begin())
            {
                var repository = new OrderRepository();

                repository.Add(order);

                //throw new System.Exception("Error");

                uow.Complete();
            }
        }