public async Task <ActionResult> createDb()
        {
            using (ChenDbContext db = new ChenDbContext())
            {
                await db.Database.EnsureCreatedAsync();

                List <UserInfo> userList = new List <UserInfo>();
                userList.Add(new UserInfo {
                    userName = "******", lastName = "semapat", email = "*****@*****.**"
                });
                userList.Add(new UserInfo {
                    userName = "******", lastName = "semapat2", email = "*****@*****.**"
                });
                userList.Add(new UserInfo {
                    userName = "******", lastName = "semapat3", email = "*****@*****.**"
                });
                await db.UserInfo.AddRangeAsync(userList);

                await db.SaveChangesAsync();

                List <Product> productList = new List <Product>();
                productList.Add(new Product {
                    productName = "Item1", remain = 10, price = 10000
                });
                productList.Add(new Product {
                    productName = "Item2", remain = 20, price = 20000
                });
                productList.Add(new Product {
                    productName = "Item3", remain = 30, price = 30000
                });
                await db.Product.AddRangeAsync(productList);

                await db.SaveChangesAsync();

                List <Order> orderList = new List <Order>();
                orderList.Add(new Order {
                    UserId = 1, ProductId = 1, value = 10
                });
                orderList.Add(new Order {
                    UserId = 2, ProductId = 2, value = 20
                });
                orderList.Add(new Order {
                    UserId = 1, ProductId = 3, value = 30
                });
                await db.Order.AddRangeAsync(orderList);

                await db.SaveChangesAsync();
            }
            return(Ok("create db successfully"));
        }
        public async Task <ActionResult> testdelete()
        {
            using (ChenDbContext db = new ChenDbContext())
            {
                UserInfo result = await db.UserInfo.Include(x => x.Order).FirstOrDefaultAsync();

                db.UserInfo.Remove(result);
                int affected = await db.SaveChangesAsync();

                return(Ok($"deleted! {affected} row"));
            }
        }