public static void Insert(CustomerComment customerComment) { using (var db = OnlineStoreDbContext.Entity) { db.CustomerComments.Add(customerComment); db.SaveChanges(); } }
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(); } }