Esempio n. 1
0
        private static async Task AddOrderItem(CosmosStoreDbContext context, Guid orderId, OrderItem item)
        {
            var order = await context.Set <Order>().FindAsync(orderId);

            order.Items.Add(item);

            await context.SaveChangesAsync();
        }
Esempio n. 2
0
        private static async Task <Order> AddOrder(CosmosStoreDbContext context, string customerName)
        {
            var entity = await context.Set <Order>().AddAsync(new Order()
            {
                CustomerName = customerName
            });

            await context.SaveChangesAsync();

            entity.State = EntityState.Detached;
            return(entity.Entity);
        }