public void AddKeyword(string keyword) { KeywordHistory keywordHistory = new KeywordHistory(); keywordHistory.DateModified = DateTime.Now; keywordHistory.Keyword = keyword; keywordHistory.ProductId = _ProductVM.Product.ProductId; SessionDataContext.KeywordHistories.Add(keywordHistory); SessionDataContext.SaveChanges(); }
public void AddInitialKeywordHistoryRecord(string keyword) { var keywordHistories = SessionDataContext .KeywordHistories .Where(x => x.ProductId == _ProductVM.Product.ProductId); if (keywordHistories.Count() != 0) { return; } KeywordHistory keywordHistory = new KeywordHistory(); keywordHistory.DateModified = DateTime.Now; keywordHistory.Keyword = keyword; keywordHistory.ProductId = _ProductVM.Product.ProductId; SessionDataContext.KeywordHistories.Add(keywordHistory); SessionDataContext.SaveChanges(); }