Exemplo n.º 1
0
 public static void RemoveNgCommentKeyword(string keyword)
 {
     using (var db = new NgDbContext())
     {
         var removeTarget = db.NgCommentKeyword.SingleOrDefault(x => x.Keyword == keyword);
         if (removeTarget != null)
         {
             db.NgCommentKeyword.Remove(removeTarget);
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
            public static void AddNgCommentKeyword(string keyword)
            {
                using (var db = new NgDbContext())
                {
                    db.NgCommentKeyword.Add(new NgCommentKeyword()
                    {
                        Keyword = keyword
                    });

                    db.SaveChanges();
                }
            }
Exemplo n.º 3
0
            public static void AddNgCommentOwner(uint userId)
            {
                using (var db = new NgDbContext())
                {
                    db.NgCommentUserId.Add(new NgCommentUserId()
                    {
                        UserId = userId
                    });

                    db.SaveChanges();
                }
            }
Exemplo n.º 4
0
 public static void RemoveNgCommentOwner(uint userId)
 {
     using (var db = new NgDbContext())
     {
         var removeTarget = db.NgCommentUserId.SingleOrDefault(x => x.UserId == userId);
         if (removeTarget != null)
         {
             db.NgCommentUserId.Remove(removeTarget);
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 5
0
 private void initCustomers(NgDbContext dbContext)
 {
     dbContext.Customers.Add(new Customer {
         Name = "JB Lin", Phone = "0933XXXXXX", Age = 35, Description = "JB is a good programmer :)"
     });
     dbContext.Customers.Add(new Customer {
         Name = "Lily Yang", Phone = "0910YYYYYY", Age = 18, Description = "Lily is a mother."
     });
     dbContext.Customers.Add(new Customer {
         Name = "Leia Lin", Phone = "-", Age = 3, Description = "A cute girl!"
     });
     dbContext.SaveChanges();
 }