/// <summary> /// Inserts a related product /// </summary> /// <param name="relatedProduct">Related product</param> public void InsertRelatedProduct(RelatedProduct relatedProduct) { if (relatedProduct == null) throw new ArgumentNullException("relatedProduct"); _context.RelatedProducts.AddObject(relatedProduct); _context.SaveChanges(); }
/// <summary> /// Updates a related product /// </summary> /// <param name="relatedProduct">Related product</param> public void UpdateRelatedProduct(RelatedProduct relatedProduct) { if (relatedProduct == null) throw new ArgumentNullException("relatedProduct"); if (!_context.IsAttached(relatedProduct)) _context.RelatedProducts.Attach(relatedProduct); _context.SaveChanges(); }
private static RelatedProduct DBMapping(DBRelatedProduct dbItem) { if (dbItem == null) return null; RelatedProduct item = new RelatedProduct(); item.RelatedProductID = dbItem.RelatedProductID; item.ProductID1 = dbItem.ProductID1; item.ProductID2 = dbItem.ProductID2; item.DisplayOrder = dbItem.DisplayOrder; return item; }