Esempio n. 1
0
        public Model.Order InsertOrUpdate(Model.Order order)
        {
            using (var context = new DataModelDataContext())
            {
                Order target = null;
                if (order.Id != Guid.Empty)
                {
                    target = context.Orders.SingleOrDefault(e => e.Id == order.Id);
                    if (target == null)
                    {
                        return(null);
                    }
                    target.State = order.State;
                }
                else
                {
                    target = new Order
                    {
                        Id        = Guid.NewGuid(),
                        State     = "ManagerApproving",
                        StateName = "Manager approving",
                    };
                    context.Orders.InsertOnSubmit(target);
                }
                target.OwnerId = order.OwnerId;
                context.SubmitChanges();

                order.Id = target.Id;
                return(order);
            }
        }
Esempio n. 2
0
        public ActionResult CreateDummyOrder()
        {
            var order = new WorkflowEngine.Model.Order()
            {
                OwnerId = Guid.Parse("E0FCA1E6-B6EA-44B1-AF68-8E63E125A6BF"),
            };

            _orderRepository.InsertOrUpdate(order);
            return(Content("Order created"));
        }