Exemple #1
0
        public async Task InsertAsync(OrderDetail entity)
        {
            var num = ctx.Orders.Select(c => c.OrderNumber).LastOrDefault();
            var n   = num;

            entity.OrderId          = n;
            ctx.Entry(entity).State = EntityState.Added;
            await ctx.SaveChangesAsync();
        }
        public async Task InsertAsync(Order entity)
        {
            var num = ctx.Orders.Select(c => c.OrderNumber).LastOrDefault();

            if (entity.OrderNumber == 0 || entity.OrderNumber == null)
            {
                entity.OrderNumber = num + 1;
            }
            //ctx.Add(entity);
            ctx.Entry(entity).State = EntityState.Added;
            await ctx.SaveChangesAsync();
        }
Exemple #3
0
 public async Task InsertAsync(Product entity)
 {
     ctx.Entry(entity).State = EntityState.Added;
     await ctx.SaveChangesAsync();
 }
Exemple #4
0
 public async Task InsertAsync(Customer entity)
 {
     //ctx.Add(entity);
     ctx.Entry(entity).State = EntityState.Added;
     await ctx.SaveChangesAsync();
 }