예제 #1
0
        public static void Insert(CustomerComment customerComment)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                db.CustomerComments.Add(customerComment);

                db.SaveChanges();
            }
        }
예제 #2
0
        public static void Update(CustomerComment customerComment)
        {
            using (var db = OnlineStoreDbContext.Entity)
            {
                var orgCustomerComment = db.CustomerComments.Where(item => item.ID == customerComment.ID).Single();

                orgCustomerComment.UserName   = customerComment.UserName;
                orgCustomerComment.Text       = customerComment.Text;
                orgCustomerComment.Title      = customerComment.Title;
                orgCustomerComment.Image      = customerComment.Image;
                orgCustomerComment.IsVisible  = customerComment.IsVisible;
                orgCustomerComment.DateTime   = customerComment.DateTime;
                orgCustomerComment.LastUpdate = customerComment.LastUpdate;

                db.SaveChanges();
            }
        }