/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } //_productManufacturerRepository.Update(productManufacturer); var builder = Builders <Product> .Filter; var filter = builder.Eq(x => x.Id, productManufacturer.ProductId); filter = filter & builder.Where(x => x.ProductManufacturers.Any(y => y.Id == productManufacturer.Id)); var update = Builders <Product> .Update .Set(x => x.ProductManufacturers.ElementAt(-1).ManufacturerId, productManufacturer.ManufacturerId) .Set(x => x.ProductManufacturers.ElementAt(-1).IsFeaturedProduct, productManufacturer.IsFeaturedProduct) .Set(x => x.ProductManufacturers.ElementAt(-1).DisplayOrder, productManufacturer.DisplayOrder); var result = _productRepository.Collection.UpdateManyAsync(filter, update).Result; //cache _cacheManager.RemoveByPattern(MANUFACTURERS_PATTERN_KEY); _cacheManager.RemoveByPattern(PRODUCTMANUFACTURERS_PATTERN_KEY); _cacheManager.RemoveByPattern(string.Format(PRODUCTS_BY_ID_KEY, productManufacturer.ProductId)); //event notification _eventPublisher.EntityUpdated(productManufacturer); }
public HttpResponseMessage NavigationProductManufacturers(int key, int relatedKey) { var productManufacturers = _manufacturerService.Value.GetProductManufacturersByProductId(key, true); var productManufacturer = productManufacturers.FirstOrDefault(x => x.ManufacturerId == relatedKey); if (Request.Method == HttpMethod.Post) { if (productManufacturer == null) { productManufacturer = new ProductManufacturer { ProductId = key, ManufacturerId = relatedKey }; _manufacturerService.Value.InsertProductManufacturer(productManufacturer); return(Request.CreateResponse(HttpStatusCode.Created, productManufacturer)); } } else if (Request.Method == HttpMethod.Delete) { if (productManufacturer != null) { _manufacturerService.Value.DeleteProductManufacturer(productManufacturer); } return(Request.CreateResponse(HttpStatusCode.NoContent)); } return(Request.CreateResponseForEntity(productManufacturer, relatedKey)); }
/// <summary> /// Write to the XmlWriter all needed element data for the brand. /// </summary> /// <param name="xml"> /// This XmlWriter should already be prepared. /// This method is responsible for populating the brand element. /// </param> /// <param name="product"> /// This is product from which this exports data. /// </param> private async Task ExportBrandAsync(XmlWriter xml, Product product) { // Get the manufacturer for this product. // If there are multiple, // it uses the manufacturer's display order and ID. ProductManufacturer productManufacturer = null; var productManufacturers = await _manufacturerService.GetProductManufacturersByProductIdAsync(product.Id, true); foreach (var pm in productManufacturers) { var manufacturer = await _manufacturerService.GetManufacturerByIdAsync(pm.ManufacturerId); if (manufacturer != null && manufacturer.Published) { productManufacturer = pm; break; } } if (productManufacturer != null) { WriteElementHelper( xml, _brandTag, (await _manufacturerService.GetManufacturerByIdAsync(productManufacturer.ManufacturerId)).Name ); } return; }
public virtual ProductManufacturer InsertProductManufacturer(ProductManufacturer entity) { ProductManufacturer other = new ProductManufacturer(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into ProductManufacturer ( [ProductID] ,[ManufacturerID] ,[DisplayOrder] ,[CreatedOn] ) Values ( @ProductID , @ManufacturerID , @DisplayOrder , @CreatedOn ); Select scope_identity()" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@ProductID", entity.ProductId) , new SqlParameter("@ManufacturerID", entity.ManufacturerId) , new SqlParameter("@DisplayOrder", entity.DisplayOrder) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray); if (identity == DBNull.Value) { throw new DataException("Identity column was null as a result of the insert operation."); } return(GetProductManufacturer(Convert.ToInt32(identity))); } return(entity); }
public ActionResult ProductAdd(int manufacturerId, int[] selectedProductIds) { var products = _productService.GetProductsByIds(selectedProductIds); ProductManufacturer productManu = null; var maxDisplayOrder = -1; foreach (var product in products) { var existingProductManus = _manufacturerService.GetProductManufacturersByManufacturerId(manufacturerId, 0, int.MaxValue, true); if (!existingProductManus.Any(x => x.ProductId == product.Id && x.ManufacturerId == manufacturerId)) { if (maxDisplayOrder == -1 && (productManu = existingProductManus.OrderByDescending(x => x.DisplayOrder).FirstOrDefault()) != null) { maxDisplayOrder = productManu.DisplayOrder; } _manufacturerService.InsertProductManufacturer(new ProductManufacturer { ManufacturerId = manufacturerId, ProductId = product.Id, IsFeaturedProduct = false, DisplayOrder = ++maxDisplayOrder }); } } return(new EmptyResult()); }
/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual async Task UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } var builder = Builders <Product> .Filter; var filter = builder.Eq(x => x.Id, productManufacturer.ProductId); filter = filter & builder.Where(x => x.ProductManufacturers.Any(y => y.Id == productManufacturer.Id)); var update = Builders <Product> .Update .Set(x => x.ProductManufacturers.ElementAt(-1).ManufacturerId, productManufacturer.ManufacturerId) .Set(x => x.ProductManufacturers.ElementAt(-1).IsFeaturedProduct, productManufacturer.IsFeaturedProduct) .Set(x => x.ProductManufacturers.ElementAt(-1).DisplayOrder, productManufacturer.DisplayOrder); await _productRepository.Collection.UpdateManyAsync(filter, update); //cache await _cacheManager.RemoveByPrefix(CacheKey.PRODUCTMANUFACTURERS_PATTERN_KEY); await _cacheManager.RemoveAsync(string.Format(CacheKey.PRODUCTS_BY_ID_KEY, productManufacturer.ProductId)); //event notification await _mediator.EntityUpdated(productManufacturer); }
public virtual ProductManufacturer UpdateProductManufacturer(ProductManufacturer entity) { if (entity.IsTransient()) { return(entity); } ProductManufacturer other = GetProductManufacturer(entity.ProductId); if (entity.Equals(other)) { return(entity); } string sql = @"Update ProductManufacturer set [ManufacturerID]=@ManufacturerID , [DisplayOrder]=@DisplayOrder , [CreatedOn]=@CreatedOn where ProductID=@ProductID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@ProductID", entity.ProductId) , new SqlParameter("@ManufacturerID", entity.ManufacturerId) , new SqlParameter("@DisplayOrder", entity.DisplayOrder) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetProductManufacturer(entity.ProductId)); }
private List <ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(List <ProductManufacturer> ExistingProductManufacturerCollection) { var manufacturerCollection = ManufacturerManager.GetAllManufacturers(); List <ProductManufacturerMappingHelperClass> result = new List <ProductManufacturerMappingHelperClass>(); for (int i = 0; i < manufacturerCollection.Count; i++) { Manufacturer manufacturer = manufacturerCollection[i]; ProductManufacturer existingProductManufacturer = null; if (ExistingProductManufacturerCollection != null) { existingProductManufacturer = ExistingProductManufacturerCollection.FindProductManufacturer(this.ProductId, manufacturer.ManufacturerId); } ProductManufacturerMappingHelperClass pmm = new ProductManufacturerMappingHelperClass(); if (existingProductManufacturer != null) { pmm.ProductManufacturerId = existingProductManufacturer.ProductManufacturerId; pmm.IsMapped = true; pmm.IsFeatured = existingProductManufacturer.IsFeaturedProduct; pmm.DisplayOrder = existingProductManufacturer.DisplayOrder; } else { pmm.DisplayOrder = 1; } pmm.ManufacturerId = manufacturer.ManufacturerId; pmm.ManufacturerInfo = manufacturer.Name; MapState(manufacturer.ManufacturerId, pmm); result.Add(pmm); } return(result); }
protected static ProductManufacturerModel MapProductManufacturer(ProductManufacturer manufacturer) { return(new ProductManufacturerModel { Id = manufacturer.Id, Name = manufacturer.Name, ImageUrl = GetImageUrl(manufacturer.LogoKey) }); }
/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException(nameof(productManufacturer)); } _productManufacturerRepository.Update(productManufacturer); }
public virtual async Task InsertProductManufacturer(ProductDto product, ProductManufacturerDto model) { var productManufacturer = new ProductManufacturer { ProductId = product.Id, ManufacturerId = model.ManufacturerId, IsFeaturedProduct = model.IsFeaturedProduct, }; await _manufacturerService.InsertProductManufacturer(productManufacturer); }
/// <summary> /// Inserts a product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void InsertProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } _productManufacturerRepository.Insert(productManufacturer); //_unitOfWork.Commit(); }
public void CreatedOnTest() { // Test Variable declaration DateTime expectedDateValue = DateTime.Now; ProductManufacturer productManufacturer = new ProductManufacturer(Guid.NewGuid()) { CreatedOn = expectedDateValue }; DateTime createdOn = productManufacturer.CreatedOn; // Assertions Assert.IsNotNull(productManufacturer.CreatedOn); Assert.AreEqual(expectedDateValue, productManufacturer.CreatedOn); }
public async Task <bool> Handle(AddProductManufacturerCommand request, CancellationToken cancellationToken) { var productManufacturer = new ProductManufacturer { ProductId = request.Product.Id, ManufacturerId = request.Model.ManufacturerId, IsFeaturedProduct = request.Model.IsFeaturedProduct, }; await _manufacturerService.InsertProductManufacturer(productManufacturer); return(true); }
public IActionResult CreateProductManufacturerMapping( [ModelBinder(typeof(JsonModelBinder <ProductManufacturerMappingsDto>))] Delta <ProductManufacturerMappingsDto> productManufacturerDelta) { // Here we display the errors if the validation has failed at some point. if (!ModelState.IsValid) { return(Error()); } var Manufacturer = _manufacturerApiService.GetManufacturerById(productManufacturerDelta.Dto.ManufacturerId.Value); if (Manufacturer == null) { return(Error(HttpStatusCode.NotFound, "manufacturer_id", "not found")); } var product = _productApiService.GetProductById(productManufacturerDelta.Dto.ProductId.Value); if (product == null) { return(Error(HttpStatusCode.NotFound, "product_id", "not found")); } var mappingsCount = _productManufacturerMappingsService.GetMappingsCount(product.Id, Manufacturer.Id); if (mappingsCount > 0) { return(Error(HttpStatusCode.BadRequest, "product_manufacturer_mapping", "already exist")); } var newProductManufacturer = new ProductManufacturer(); productManufacturerDelta.Merge(newProductManufacturer); //inserting new Manufacturer _manufacturerService.InsertProductManufacturer(newProductManufacturer); // Preparing the result dto of the new product Manufacturer mapping var newProductManufacturerMappingDto = newProductManufacturer.ToDto(); var productManufacturerMappingsRootObject = new ProductManufacturerMappingsRootObject(); productManufacturerMappingsRootObject.ProductManufacturerMappingsDtos.Add(newProductManufacturerMappingDto); var json = JsonFieldsSerializer.Serialize(productManufacturerMappingsRootObject, string.Empty); //activity log CustomerActivityService.InsertActivity("AddNewProductManufacturerMapping", LocalizationService.GetResource("ActivityLog.AddNewProductManufacturerMapping"), newProductManufacturer); return(new RawJsonActionResult(json)); }
/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException(nameof(productManufacturer)); } _productManufacturerRepository.Update(productManufacturer); //event notification _eventPublisher.EntityUpdated(productManufacturer); }
public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } _productManufacturerRepository.Update(productManufacturer); _requestCache.RemoveByPattern(MANUFACTURERS_PATTERN_KEY); _requestCache.RemoveByPattern(PRODUCTMANUFACTURERS_PATTERN_KEY); }
protected virtual int ProcessProductManufacturers(ImportExecuteContext context, IEnumerable <ImportRow <Product> > batch) { _productManufacturerRepository.AutoCommitEnabled = false; ProductManufacturer lastInserted = null; foreach (var row in batch) { var manufacturerIds = row.GetDataValue <List <int> >("ManufacturerIds"); if (!manufacturerIds.IsNullOrEmpty()) { try { foreach (var id in manufacturerIds) { if (_productManufacturerRepository.TableUntracked.Where(x => x.ProductId == row.Entity.Id && x.ManufacturerId == id).FirstOrDefault() == null) { // ensure that manufacturer exists var manufacturer = _manufacturerService.GetManufacturerById(id); if (manufacturer != null) { var productManufacturer = new ProductManufacturer { ProductId = row.Entity.Id, ManufacturerId = manufacturer.Id, IsFeaturedProduct = false, DisplayOrder = 1 }; _productManufacturerRepository.Insert(productManufacturer); lastInserted = productManufacturer; } } } } catch (Exception exception) { context.Result.AddWarning(exception.Message, row.GetRowInfo(), "ManufacturerIds"); } } } // commit whole batch at once var num = _productManufacturerRepository.Context.SaveChanges(); // Perf: notify only about LAST insertion and update if (lastInserted != null) { _services.EventPublisher.EntityInserted(lastInserted); } return(num); }
private int ProcessProductManufacturers(ICollection <ImportRow <Product> > batch, ImportResult result) { _rsProductManufacturer.AutoCommitEnabled = false; ProductManufacturer lastInserted = null; foreach (var row in batch) { string manufacturerIds = row.GetValue <string>("ManufacturerIds"); if (manufacturerIds.HasValue()) { try { foreach (var id in manufacturerIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => Convert.ToInt32(x.Trim()))) { if (_rsProductManufacturer.TableUntracked.Where(x => x.ProductId == row.Entity.Id && x.ManufacturerId == id).FirstOrDefault() == null) { // ensure that manufacturer exists var manufacturer = _manufacturerService.GetManufacturerById(id); if (manufacturer != null) { var productManufacturer = new ProductManufacturer() { ProductId = row.Entity.Id, ManufacturerId = manufacturer.Id, IsFeaturedProduct = false, DisplayOrder = 1 }; _rsProductManufacturer.Insert(productManufacturer); lastInserted = productManufacturer; } } } } catch (Exception ex) { result.AddWarning(ex.Message, row.GetRowInfo(), "ManufacturerIds"); } } } // commit whole batch at once var num = _rsProductManufacturer.Context.SaveChanges(); // Perf: notify only about LAST insertion and update if (lastInserted != null) { _eventPublisher.EntityInserted(lastInserted); } return(num); }
public virtual ProductManufacturer ProductManufacturerFromDataRow(DataRow dr) { if (dr == null) { return(null); } ProductManufacturer entity = new ProductManufacturer(); entity.ProductId = (System.Int32)dr["ProductID"]; entity.ManufacturerId = (System.Int32)dr["ManufacturerID"]; entity.DisplayOrder = (System.Int32)dr["DisplayOrder"]; entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; return(entity); }
/// <summary> /// Copy manufacturer mapping /// </summary> /// <param name="product">Product</param> /// <param name="productCopy">New product</param> /// <returns>A task that represents the asynchronous operation</returns> protected virtual async Task CopyManufacturersMappingAsync(Product product, Product productCopy) { foreach (var productManufacturers in await _manufacturerService.GetProductManufacturersByProductIdAsync(product.Id, true)) { var productManufacturerCopy = new ProductManufacturer { ProductId = productCopy.Id, ManufacturerId = productManufacturers.ManufacturerId, IsFeaturedProduct = productManufacturers.IsFeaturedProduct, DisplayOrder = productManufacturers.DisplayOrder }; await _manufacturerService.InsertProductManufacturerAsync(productManufacturerCopy); } }
/// <summary> /// Copy manufacturer mapping /// </summary> /// <param name="product">Product</param> /// <param name="productCopy">New product</param> protected virtual void CopyManufacturersMapping(Product product, Product productCopy) { foreach (var productManufacturers in _manufacturerService.GetProductManufacturersByProductId(product.Id, true)) { var productManufacturerCopy = new ProductManufacturer { ProductId = productCopy.Id, ManufacturerId = productManufacturers.ManufacturerId, IsFeaturedProduct = productManufacturers.IsFeaturedProduct, DisplayOrder = productManufacturers.DisplayOrder }; _manufacturerService.InsertProductManufacturer(productManufacturerCopy); } }
/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException(nameof(productManufacturer)); } _productManufacturerRepository.Update(productManufacturer); //cache _cacheManager.RemoveByPattern(MANUFACTURERS_PATTERN_KEY); _cacheManager.RemoveByPattern(PRODUCTMANUFACTURERS_PATTERN_KEY); //event notification _eventPublisher.EntityUpdated(productManufacturer); }
/// <summary> /// Inserts a product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void InsertProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException(nameof(productManufacturer)); } _productManufacturerRepository.Insert(productManufacturer); //cache _cacheManager.RemoveByPrefix(NopCatalogDefaults.ManufacturersPrefixCacheKey); _cacheManager.RemoveByPrefix(NopCatalogDefaults.ProductManufacturersPrefixCacheKey); //event notification _eventPublisher.EntityInserted(productManufacturer); }
public virtual void InsertProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } _productManufacturerRepository.Insert(productManufacturer); //cache _requestCache.RemoveByPattern(MANUFACTURERS_PATTERN_KEY); _requestCache.RemoveByPattern(PRODUCTMANUFACTURERS_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(productManufacturer); }
/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } _productManufacturerRepository.Update(productManufacturer); //cache _cacheManager.GetCache(CACHE_NAME_MANUFACTURERS).Clear(); _cacheManager.GetCache(CACHE_NAME_PRODUCTMANUFACTURERS).Clear(); //event notification //_eventPublisher.EntityUpdated(productManufacturer); }
/// <summary> /// Updates the product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual void UpdateProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException(nameof(productManufacturer)); } _productManufacturerRepository.Update(productManufacturer); //cache _cacheManager.RemoveByPattern(NopCatalogDefaults.ManufacturersPatternCacheKey); _cacheManager.RemoveByPattern(NopCatalogDefaults.ProductManufacturersPatternCacheKey); //event notification _eventPublisher.EntityUpdated(productManufacturer); }
public void MapProductManufacturerTest01() { // Arrange var manufacturer = new ProductManufacturer { Id = 1, Name = "Bob" }; // Act var result = MockBuilderBase.MapProductManufacturer(manufacturer); // Assert Assert.AreEqual(1, result.Id); Assert.AreEqual("Bob", result.Name); Assert.AreEqual(null, result.ImageUrl); }
public void Can_save_and_load_productManufacturer() { var productManufacturer = new ProductManufacturer { IsFeaturedProduct = true, DisplayOrder = 1, Product = new Product() { Name = "Name 1", Published = true, Deleted = false, CreatedOnUtc = new DateTime(2010, 01, 01), UpdatedOnUtc = new DateTime(2010, 01, 02) }, Manufacturer = new Manufacturer() { Name = "Name", Description = "Description 1", MetaKeywords = "Meta keywords", MetaDescription = "Meta description", MetaTitle = "Meta title", SeName = "SE name", PictureId = 3, PageSize = 4, PriceRanges = "1-3;", Published = true, Deleted = false, DisplayOrder = 5, CreatedOnUtc = new DateTime(2010, 01, 01), UpdatedOnUtc = new DateTime(2010, 01, 02), } }; var fromDb = SaveAndLoadEntity(productManufacturer); fromDb.ShouldNotBeNull(); fromDb.IsFeaturedProduct.ShouldEqual(true); fromDb.DisplayOrder.ShouldEqual(1); fromDb.Product.ShouldNotBeNull(); fromDb.Product.Name.ShouldEqual("Name 1"); fromDb.Manufacturer.ShouldNotBeNull(); fromDb.Manufacturer.Name.ShouldEqual("Name"); }
public void MapProductManufacturerTest02() { // Arrange var manufacturer = new ProductManufacturer { Id = 1, Name = "Bob", LogoKey = Guid.Empty }; // Act var result = MockBuilderBase.MapProductManufacturer(manufacturer); // Assert Assert.AreEqual(1, result.Id); Assert.AreEqual("Bob", result.Name); Assert.AreEqual("http://services.enferno.se/image/00000000-0000-0000-0000-000000000000.jpg", result.ImageUrl); }
/// <summary> /// Inserts a product manufacturer mapping /// </summary> /// <param name="productManufacturer">Product manufacturer mapping</param> public virtual async Task InsertProductManufacturer(ProductManufacturer productManufacturer) { if (productManufacturer == null) { throw new ArgumentNullException("productManufacturer"); } var updatebuilder = Builders <Product> .Update; var update = updatebuilder.AddToSet(p => p.ProductManufacturers, productManufacturer); await _productRepository.Collection.UpdateOneAsync(new BsonDocument("_id", productManufacturer.ProductId), update); //cache await _cacheManager.RemoveByPrefix(CacheKey.PRODUCTMANUFACTURERS_PATTERN_KEY); await _cacheManager.RemoveAsync(string.Format(CacheKey.PRODUCTS_BY_ID_KEY, productManufacturer.ProductId)); //event notification await _mediator.EntityInserted(productManufacturer); }
public void ManufacturerIdTest() { // Test Variable declaration Guid expectedValueId = Guid.NewGuid(); ProductManufacturer productManufacturer = new ProductManufacturer(expectedValueId); // Assertions Assert.IsNotNull(productManufacturer.ManufacturerId); Assert.AreEqual(expectedValueId, productManufacturer.ManufacturerId); Assert.AreNotSame(expectedValueId, productManufacturer.ManufacturerId); }
/// <summary> /// Insert a new manufacturer to the product which productId makes reference /// </summary> /// <param name="productId"></param> /// <param name="productManufacturer"></param> public void InsertProductManufacturer(int productId, ProductManufacturer productManufacturer) { // // binds a manufacturer to a product // productManufacturer.ProductId = productId; DbContext.ProductManufacturers.InsertOnSubmit(productManufacturer); DbContext.SubmitChanges(); }