Exemplo n.º 1
0
        public Order CreateOrder(Order order)
        {
            if (order.Customer != null)
            {
                _ctx.Attach(order.Customer);
            }

            _ctx.Attach(order.Product);
            var order2Add = _ctx.Orders.Add(order).Entity;

            _ctx.SaveChanges();
            return(order2Add);
        }