public static void Insert(ProductQuestion question) { using (var db = OnlineStoreDbContext.Entity) { db.ProductQuestions.Add(question); db.SaveChanges(); } }
public static void Update(ProductQuestion productQuestion) { using (var db = OnlineStoreDbContext.Entity) { var orgQuestion = db.ProductQuestions.Where(item => item.ID == productQuestion.ID).Single(); orgQuestion.Question = productQuestion.Question; orgQuestion.Reply = productQuestion.Reply; orgQuestion.QuestionStatus = productQuestion.QuestionStatus; orgQuestion.LastUpdate = productQuestion.LastUpdate; orgQuestion.IsVisible = productQuestion.IsVisible; db.SaveChanges(); } }