예제 #1
0
 public static IReadOnlyList <uint> GetNgCommentOwnerIds()
 {
     using (var db = new NgDbContext())
     {
         return(db.NgCommentUserId.Select(x => x.UserId).ToList());
     }
 }
예제 #2
0
 public static IReadOnlyList <string> GetNgCommentKeyword()
 {
     using (var db = new NgDbContext())
     {
         return(db.NgCommentKeyword.Select(x => x.Keyword).ToList());
     }
 }
예제 #3
0
        public static NGResult IsNgComment(string comment, uint userId)
        {
            using (var db = new NgDbContext())
            {
                if (db.NgCommentUserId.Any(x => x.UserId == userId))
                {
                    return(new NGResult()
                    {
                        NGReason = NGReason.UserId,
                        NGDescription = "",
                        Content = userId.ToString(),
                    });
                }

                var ngKeyword = db.NgCommentKeyword.FirstOrDefault(x => 0 != comment.IndexOf(x.Keyword));
                if (ngKeyword != null)
                {
                    return(new NGResult()
                    {
                        NGReason = NGReason.Keyword,
                        Content = userId.ToString()
                    });
                }

                return(null);
            }
        }
예제 #4
0
 public CustomerService(NgDbContext dbContext)
 {
     if (dbContext != null)
     {
         this._dbContext = dbContext;
     }
 }
예제 #5
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();
         }
     }
 }
예제 #6
0
            public static void AddNgCommentKeyword(string keyword)
            {
                using (var db = new NgDbContext())
                {
                    db.NgCommentKeyword.Add(new NgCommentKeyword()
                    {
                        Keyword = keyword
                    });

                    db.SaveChanges();
                }
            }
예제 #7
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();
         }
     }
 }
예제 #8
0
            public static void AddNgCommentOwner(uint userId)
            {
                using (var db = new NgDbContext())
                {
                    db.NgCommentUserId.Add(new NgCommentUserId()
                    {
                        UserId = userId
                    });

                    db.SaveChanges();
                }
            }
예제 #9
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();
 }
 public FeaturesController(NgDbContext context)
 {
     this.context = context;
 }
예제 #11
0
 public MakesController(NgDbContext Context, IMapper mapper)
 {
     this.mapper  = mapper;
     this.Context = Context;
 }