public long InsertProduct(VenueProduct product) { var p = new DynamicParameters(new { PartNumber = product.PartNumber, ProductName = product.ProductName, Brand = product.Brand, Merchant = product.Merchant, Merchantid = product.MerchantId, Description = product.Description, URL = product.ProductURL, Reatil_price = product.ReatilPrice, Saleprice = product.SalePrice, Price = product.Price, OnSale = product.OnSale, ShippingCharge = product.ShippingCharge, ShipFlatRate = product.ShipFlatRate, CategoryId = product.CategoryId, CatalogId = product.CatalogId }); p.Add("@newId", DbType.Int64, direction: ParameterDirection.Output); Connection.Execute("InsertProduct", p, commandType: CommandType.StoredProcedure); return(p.Get <dynamic>("newId")); }
public void UpdateProduct(Product product, VenueProduct orginal, string catalogId) { _log.DebugFormat("Update Product : ID {0}", orginal.Id); orginal.OnSale = product.onSale; orginal.Price = product.price; orginal.CatalogId = catalogId; orginal.Description = product.description; orginal.ReatilPrice = product.reatil_price; orginal.SalePrice = product.sale_price; orginal.ShipFlatRate = product.ship_flat_rate; orginal.ShippingCharge = product.shipping_charge; _productRepository.UpdateProduct(orginal); var orgColors = _productRepository.GetProductColors(orginal.Id); foreach (var color in product.colors) { var item = orgColors.FirstOrDefault(x => x.ColorName == color.color); if (item == null) { string imageUrl = color.image.Length == 0 ? product.image[0] : color.image[0]; InsertProductColor(color, orginal.Id, imageUrl); } else { item.RetailPrice = color.retail_price; _productRepository.UpdateColor(item); UpdateSize(color, item.Id); } } foreach (var color in orgColors) { var item = product.colors.Find(x => x.color == color.ColorName); if (item == null) { _productRepository.DeleteColor(color.Id); } } }
public void UpdateProduct(VenueProduct product) { var p = new DynamicParameters(new { Description = product.Description, URL = product.ProductURL, Reatil_price = product.ReatilPrice, Saleprice = product.SalePrice, Price = product.Price, OnSale = product.OnSale, ShippingCharge = product.ShippingCharge, ShipFlatRate = product.ShipFlatRate, CatalogId = product.CatalogId, Id = product.Id }); Connection.Execute("UpdateProduct", p, commandType: CommandType.StoredProcedure); }