public static void Insert(ScoreComment scoreComment) { using (var db = OnlineStoreDbContext.Entity) { db.ScoreComments.Add(scoreComment); db.SaveChanges(); } }
public static void UpdateByUser(ScoreComment scoreComment) { using (var db = OnlineStoreDbContext.Entity) { var orgComment = db.ScoreComments.Where(item => item.ID == scoreComment.ID).Single(); orgComment.Text = scoreComment.Text; orgComment.LastUpdate = scoreComment.LastUpdate; db.SaveChanges(); } }