public static void Insert(ProductComment comment) { using (var db = OnlineStoreDbContext.Entity) { db.ProductComments.Add(comment); db.SaveChanges(); } }
public static void Update(ProductComment comment) { using (var db = OnlineStoreDbContext.Entity) { var orgComment = db.ProductComments.Where(item => item.ID == comment.ID).Single(); orgComment.CommentStatus = comment.CommentStatus; orgComment.Subject = comment.Subject; orgComment.Text = comment.Text; db.SaveChanges(); } }