Esempio n. 1
0
 protected override void MergeSubItems(ProductFile model)
 {
     if (!string.IsNullOrEmpty(model.ProductId))
     {
         var assoc = crosses.FindByFileIdAndProductId(model.Bvin, model.ProductId);
         if (assoc == null)
         {
             assoc           = new ProductFileAssociation();
             assoc.StoreId   = model.StoreId;
             assoc.FileId    = model.Bvin;
             assoc.ProductId = model.ProductId;
         }
         assoc.LastUpdatedUtc   = DateTime.UtcNow;
         assoc.MaxDownloads     = model.MaxDownloads;
         assoc.AvailableMinutes = model.AvailableMinutes;
         if (assoc.Id <= 0)
         {
             crosses.Create(assoc);
         }
         else
         {
             crosses.Update(assoc);
         }
     }
 }
Esempio n. 2
0
        public bool AddAssociatedProduct(string fileBvin, string productBvin, int availableMinutes, int maxDownloads)
        {
            var storeId = Context.CurrentStore.Id;

            RemoveAssociatedProduct(fileBvin, productBvin);
            var x = new ProductFileAssociation();

            x.AvailableMinutes = availableMinutes;
            x.FileId           = fileBvin;
            x.MaxDownloads     = maxDownloads;
            x.ProductId        = productBvin;
            x.StoreId          = storeId;
            return(crosses.Create(x));
        }